[srvx-commits] CVS: services/src global.c,1.58,1.59 hash.c,1.180,1.181 helpserv.c,1.81,1.82 ioset.c,
Brought to you by:
entrope
From: Entrope <en...@us...> - 2003-09-26 15:17:03
|
Update of /cvsroot/srvx/services/src In directory sc8-pr-cvs1:/tmp/cvs-serv2120/src Modified Files: global.c hash.c helpserv.c ioset.c tools.c Log Message: formatting changes to make profiling more accurate Index: global.c =================================================================== RCS file: /cvsroot/srvx/services/src/global.c,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -r1.58 -r1.59 *** global.c 18 Aug 2003 19:36:45 -0000 1.58 --- global.c 26 Sep 2003 15:16:58 -0000 1.59 *************** *** 142,148 **** if(message->next) message->next->prev = message->prev; ! if(message->from) free(message->from); ! if(message->message) free(message->message); ! free(message); } --- 142,147 ---- if(message->next) message->next->prev = message->prev; ! free(message->from); ! free(message->message); free(message); } *************** *** 525,529 **** if(message->flags & mask) { ! if (obstreperize && !count) send_target_message(0, user->nick, global, "$b------------- MESSAGE(S) OF THE DAY --------------$b"); notice_target(user->nick, message); count++; --- 524,529 ---- if(message->flags & mask) { ! if (obstreperize && !count) ! send_target_message(0, user->nick, global, "$b------------- MESSAGE(S) OF THE DAY --------------$b"); notice_target(user->nick, message); count++; *************** *** 532,536 **** message = message->next; } ! if (obstreperize && count) send_target_message(0, user->nick, global, "$b---------- END OF MESSAGE(S) OF THE DAY ----------$b"); return count; } --- 532,537 ---- message = message->next; } ! if (obstreperize && count) ! send_target_message(0, user->nick, global, "$b---------- END OF MESSAGE(S) OF THE DAY ----------$b"); return count; } *************** *** 574,579 **** global_process_user(struct userNode *user) { ! if(IsLocal(user) || self->uplink->burst || user->uplink->burst) return 0; ! /* TODO: policers for global motd/memos may be useful. */ send_messages(user, MESSAGE_RECIPIENT_LUSERS, 1); --- 575,580 ---- global_process_user(struct userNode *user) { ! if(IsLocal(user) || self->uplink->burst || user->uplink->burst) ! return 0; send_messages(user, MESSAGE_RECIPIENT_LUSERS, 1); Index: hash.c =================================================================== RCS file: /cvsroot/srvx/services/src/hash.c,v retrieving revision 1.180 retrieving revision 1.181 diff -C2 -r1.180 -r1.181 *** hash.c 1 Sep 2003 14:44:16 -0000 1.180 --- hash.c 26 Sep 2003 15:16:58 -0000 1.181 *************** *** 171,175 **** /* don't do anything if there's no change */ old_nick = user->nick; ! if (!strncmp(new_nick, old_nick, NICKLEN)) return; /* remove old entry from clients dictionary */ --- 171,176 ---- /* don't do anything if there's no change */ old_nick = user->nick; ! if (!strncmp(new_nick, old_nick, NICKLEN)) ! return; /* remove old entry from clients dictionary */ *************** *** 189,199 **** * place because that is slightly more useful. */ ! for (nn=0; nn<ncf2_used; nn++) { ncf2_list[nn](user, old_nick); - } user->timestamp = now; ! if (IsLocal(user) && !no_announce) { irc_nick(user, old_nick); - } free(old_nick); } --- 190,198 ---- * place because that is slightly more useful. */ ! for (nn=0; nn<ncf2_used; nn++) ncf2_list[nn](user, old_nick); user->timestamp = now; ! if (IsLocal(user) && !no_announce) irc_nick(user, old_nick); free(old_nick); } *************** *** 225,232 **** P10 Protocol violation if (user->modes & FLAGS_STAMPED) here. */ ! if(account_func) ! { account_func(user, stamp); - } #ifdef WITH_PROTOCOL_P10 --- 224,229 ---- P10 Protocol violation if (user->modes & FLAGS_STAMPED) here. */ ! if (account_func) account_func(user, stamp); #ifdef WITH_PROTOCOL_P10 *************** *** 242,246 **** /* The P10 protocol says we can't stamp users who already have a stamp. */ ! if(IsStamped(user)) return; #endif --- 239,244 ---- /* The P10 protocol says we can't stamp users who already have a stamp. */ ! if (IsStamped(user)) ! return; #endif *************** *** 381,389 **** /* if it's a new or updated channel, make callbacks */ ! if (rel_age > 0) { ! for (nn=0; nn<ncf_used; nn++) { ncf_list[nn](cNode); - } - } /* go through list of bans and add each one */ --- 379,385 ---- /* if it's a new or updated channel, make callbacks */ ! if (rel_age > 0) ! for (nn=0; nn<ncf_used; nn++) ncf_list[nn](cNode); /* go through list of bans and add each one */ *************** *** 391,396 **** for (nn=0; banlist[nn];) { char *ban = banlist+nn; ! while (banlist[nn] != ' ' && banlist[nn]) nn++; ! while (banlist[nn] == ' ') banlist[nn++] = 0; AddChannelBan(1, (const char **)&ban, cNode, NULL, now, 0); } --- 387,394 ---- for (nn=0; banlist[nn];) { char *ban = banlist+nn; ! while (banlist[nn] != ' ' && banlist[nn]) ! nn++; ! while (banlist[nn] == ' ') ! banlist[nn++] = 0; AddChannelBan(1, (const char **)&ban, cNode, NULL, now, 0); } *************** *** 457,461 **** mNode = GetUserMode(channel, user); ! if (mNode) return mNode; /* already in channel */ mNode = malloc(sizeof(*mNode)); --- 455,460 ---- mNode = GetUserMode(channel, user); ! if (mNode) ! return mNode; mNode = malloc(sizeof(*mNode)); *************** *** 510,517 **** { unsigned int i; ! for (i=0; i<pf_used; i++) { ! if (pf_list[i] == handler) break; ! } ! if (i == pf_used) return; memmove(pf_list+i, pf_list+i+1, (pf_used-i-1)*sizeof(pf_list[0])); pf_used--; --- 509,517 ---- { unsigned int i; ! for (i=0; i<pf_used; i++) ! if (pf_list[i] == handler) ! break; ! if (i == pf_used) ! return; memmove(pf_list+i, pf_list+i+1, (pf_used-i-1)*sizeof(pf_list[0])); pf_used--; *************** *** 527,534 **** UnlockChannel(struct chanNode *channel) { ! if (!channel->locks) return; ! if (!--channel->locks && !channel->members.used) { DelChannel(channel); - } } --- 527,534 ---- UnlockChannel(struct chanNode *channel) { ! if (!channel->locks) ! return; ! if (!--channel->locks && !channel->members.used) DelChannel(channel); } *************** *** 548,552 **** * In this case, we get no usermode, and should not try to free it. */ ! if (!mNode) return; /* remove modeNode from channel and user */ --- 548,553 ---- * In this case, we get no usermode, and should not try to free it. */ ! if (!mNode) ! return; /* remove modeNode from channel and user */ *************** *** 555,563 **** free(mNode); ! for (n=0; n<pf_used; n++) pf_list[n](user, channel, reason); ! if (!deleting && !channel->members.used && !channel->locks) { DelChannel(channel); - } } --- 556,564 ---- free(mNode); ! for (n=0; n<pf_used; n++) ! pf_list[n](user, channel, reason); ! if (!deleting && !channel->members.used && !channel->locks) DelChannel(channel); } *************** *** 565,573 **** KickChannelUser(struct userNode* target, struct chanNode* channel, struct userNode *kicker, const char *why) { ! if (!target || !channel || IsService(target) || !GetUserMode(channel, target)) return; /* don't remove them from the channel, since the server will send a PART */ irc_kick(kicker, target, channel, why); ! if(IsLocal(target)) { /* NULL reason because we don't want a PART message to be --- 566,575 ---- KickChannelUser(struct userNode* target, struct chanNode* channel, struct userNode *kicker, const char *why) { ! if (!target || !channel || IsService(target) || !GetUserMode(channel, target)) ! return; /* don't remove them from the channel, since the server will send a PART */ irc_kick(kicker, target, channel, why); ! if (IsLocal(target)) { /* NULL reason because we don't want a PART message to be *************** *** 601,620 **** struct modeNode *mn; ! if (!victim || !channel || IsService(victim) || !GetUserMode(channel, victim)) return; /* Update the kicker's idle time (kicker may be null if it was a server) */ ! if (kicker && (mn = GetUserMode(channel, kicker))) { mn->idle_since = now; - } ! for (n=0; n<kf_used; n++) { kf_list[n](kicker, victim, channel); - } DelChannelUser(victim, channel, 0, 0); ! if (IsLocal(victim)) { irc_part(victim, channel, NULL); - } } --- 603,620 ---- struct modeNode *mn; ! if (!victim || !channel || IsService(victim) || !GetUserMode(channel, victim)) ! return; /* Update the kicker's idle time (kicker may be null if it was a server) */ ! if (kicker && (mn = GetUserMode(channel, kicker))) mn->idle_since = now; ! for (n=0; n<kf_used; n++) kf_list[n](kicker, victim, channel); DelChannelUser(victim, channel, 0, 0); ! if (IsLocal(victim)) irc_part(victim, channel, NULL); } *************** *** 710,720 **** unsigned int n; ! for(n = 0; n < channel->banlist.used; n++) ! { ! if(match_ircglobs(channel->banlist.list[n]->ban, ban)) ! { return 1; - } - } return 0; } --- 710,716 ---- unsigned int n; ! for (n = 0; n < channel->banlist.used; n++) ! if (match_ircglobs(channel->banlist.list[n]->ban, ban)) return 1; return 0; } *************** *** 729,733 **** for (n=0; n<num; n++) { ! if (channel->banlist.used >= MAXBANS) break; /* We check for bans that are a superset (or match) of an --- 725,730 ---- for (n=0; n<num; n++) { ! if (channel->banlist.used >= MAXBANS) ! break; /* We check for bans that are a superset (or match) of an *************** *** 740,744 **** for (i = 0; i < channel->banlist.used; i++) { if (match_ircglobs(banset[n], bans[i]->ban)) { ! if (!remove) remove = alloc_string_list(2); string_list_append(remove, strdup(bans[i]->ban)); } --- 737,742 ---- for (i = 0; i < channel->banlist.used; i++) { if (match_ircglobs(banset[n], bans[i]->ban)) { ! if (!remove) ! remove = alloc_string_list(2); string_list_append(remove, strdup(bans[i]->ban)); } *************** *** 761,765 **** free_string_list(remove); } ! if (announce) chan_apply_bans(who, channel, "+b", n, banset); } --- 759,764 ---- free_string_list(remove); } ! if (announce) ! chan_apply_bans(who, channel, "+b", n, banset); } *************** *** 769,773 **** unsigned int n, m; ! if (announce) chan_apply_bans(who, channel, "-b", num, banset); for (n=0; n<num; n++) { for (m=0; m<channel->banlist.used; m++) { --- 768,773 ---- unsigned int n, m; ! if (announce) ! chan_apply_bans(who, channel, "-b", num, banset); for (n=0; n<num; n++) { for (m=0; m<channel->banlist.used; m++) { *************** *** 790,796 **** /* We need to announce before we op people so that we use the * right source numeric if a service is op'ing itself. */ ! if (announce) chan_apply_mode(who, channel, "+o", num, newops); for (n=0; n<num; n++) { ! if (!(mn = GetUserMode(channel, newops[n]))) continue; mn->modes |= MODE_CHANOP; } --- 790,798 ---- /* We need to announce before we op people so that we use the * right source numeric if a service is op'ing itself. */ ! if (announce) ! chan_apply_mode(who, channel, "+o", num, newops); for (n=0; n<num; n++) { ! if (!(mn = GetUserMode(channel, newops[n]))) ! continue; mn->modes |= MODE_CHANOP; } *************** *** 805,811 **** /* We need to announce before we deop people so that we use the * right source numeric if a service is deop'ing itself. */ ! if (announce) chan_apply_mode(who, channel, "-o", num, exops); for (n=0; n<num; n++) { ! if (!(mn = GetUserMode(channel, exops[n]))) continue; mn->modes &= ~MODE_CHANOP; } --- 807,815 ---- /* We need to announce before we deop people so that we use the * right source numeric if a service is deop'ing itself. */ ! if (announce) ! chan_apply_mode(who, channel, "-o", num, exops); for (n=0; n<num; n++) { ! if (!(mn = GetUserMode(channel, exops[n]))) ! continue; mn->modes &= ~MODE_CHANOP; } *************** *** 819,826 **** for (n=0; n<num; n++) { ! if (!(mn = GetUserMode(channel, newv[n]))) continue; mn->modes |= MODE_VOICE; } ! if (announce) chan_apply_mode(who, channel, "+v", num, newv); } --- 823,832 ---- for (n=0; n<num; n++) { ! if (!(mn = GetUserMode(channel, newv[n]))) ! continue; mn->modes |= MODE_VOICE; } ! if (announce) ! chan_apply_mode(who, channel, "+v", num, newv); } *************** *** 832,839 **** for (n=0; n<num; n++) { ! if (!(mn = GetUserMode(channel, exv[n]))) continue; mn->modes &= ~MODE_VOICE; } ! if (announce) chan_apply_mode(who, channel, "-v", num, exv); } --- 838,847 ---- for (n=0; n<num; n++) { ! if (!(mn = GetUserMode(channel, exv[n]))) ! continue; mn->modes &= ~MODE_VOICE; } ! if (announce) ! chan_apply_mode(who, channel, "-v", num, exv); } *************** *** 871,877 **** /* Update the setter's idle time */ ! if ((mn = GetUserMode(channel, user))) { mn->idle_since = now; - } } --- 879,884 ---- /* Update the setter's idle time */ ! if ((mn = GetUserMode(channel, user))) mn->idle_since = now; } *************** *** 881,889 **** irc_topic(user, channel, topic); } else { ! for (n=0; n<tf_used; n++) { ! if (tf_list[n](user, channel, old_topic)) { break; - } - } } } --- 888,894 ---- irc_topic(user, channel, topic); } else { ! for (n=0; n<tf_used; n++) ! if (tf_list[n](user, channel, old_topic)) break; } } Index: helpserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/helpserv.c,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -r1.81 -r1.82 *** helpserv.c 10 Sep 2003 12:23:41 -0000 1.81 --- helpserv.c 26 Sep 2003 15:16:58 -0000 1.82 *************** *** 577,581 **** enum helpserv_level nn; for (nn=HlNone; nn<=HlOper; nn++) { ! if (!irccasecmp(msg, helpserv_level_names[nn])) return nn; } log_module(HS_LOG, LOG_ERROR, "helpserv_str2level received invalid level %s.", msg); --- 577,582 ---- enum helpserv_level nn; for (nn=HlNone; nn<=HlOper; nn++) { ! if (!irccasecmp(msg, helpserv_level_names[nn])) ! return nn; [...1668 lines suppressed...] ! helpserv_notify(req->helper, HSMSG_NOTIFY_REQ_DROP, req->id, "*", req->handle->handle, "their account has been unregistered and no online users were authenticated to it"); sprintf(buf, "%lu", req->id); *************** *** 4094,4099 **** dict_delete(helpserv_users_byhand_dict); ! if (reqlog_ctx) saxdb_close_context(reqlog_ctx); ! if (reqlog_f) fclose(reqlog_f); } --- 4156,4163 ---- dict_delete(helpserv_users_byhand_dict); ! if (reqlog_ctx) ! saxdb_close_context(reqlog_ctx); ! if (reqlog_f) ! fclose(reqlog_f); } Index: ioset.c =================================================================== RCS file: /cvsroot/srvx/services/src/ioset.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** ioset.c 1 Sep 2003 14:45:07 -0000 1.17 --- ioset.c 26 Sep 2003 15:16:58 -0000 1.18 *************** *** 86,90 **** int get_avail = ioq_get_avail(ioq); memcpy(new_buf, ioq->buf + ioq->get, get_avail); ! if (ioq->put < ioq->get) memcpy(new_buf + get_avail, ioq->buf, ioq->put); free(ioq->buf); ioq->put = ioq_used(ioq); --- 86,91 ---- int get_avail = ioq_get_avail(ioq); memcpy(new_buf, ioq->buf + ioq->get, get_avail); ! if (ioq->put < ioq->get) ! memcpy(new_buf + get_avail, ioq->buf, ioq->put); free(ioq->buf); ioq->put = ioq_used(ioq); *************** *** 110,114 **** } res = calloc(1, sizeof(*res)); ! if (!res) return 0; res->fd = fd; ioq_init(&res->send, 1024); --- 111,116 ---- } res = calloc(1, sizeof(*res)); ! if (!res) ! return 0; res->fd = fd; ioq_init(&res->send, 1024); *************** *** 180,184 **** } } ! if (connect_cb) connect_cb(io_fd, ((res < 0) ? errno : 0)); return io_fd; } --- 182,187 ---- } } ! if (connect_cb) ! connect_cb(io_fd, ((res < 0) ? errno : 0)); return io_fd; } *************** *** 326,332 **** gettimeofday(&now, NULL); if (select_timeout) { ! log_module(DEBUG_LOG, LOG_INFO, "%s, at %u.%06u:%s (timeout %u.%06u)", msg, now.tv_sec, now.tv_usec, buf, select_timeout->tv_sec, select_timeout->tv_usec); } else { ! log_module(DEBUG_LOG, LOG_INFO, "%s, at %u.%06u:%s (no timeout)", msg, now.tv_sec, now.tv_usec, buf); } } --- 329,335 ---- gettimeofday(&now, NULL); if (select_timeout) { ! log_module(MAIN_LOG, LOG_DEBUG, "%s, at "FMT_TIME_T".%06ld:%s (timeout "FMT_TIME_T".%06ld)", msg, now.tv_sec, now.tv_usec, buf, select_timeout->tv_sec, select_timeout->tv_usec); } else { ! log_module(MAIN_LOG, LOG_DEBUG, "%s, at "FMT_TIME_T".%06ld:%s (no timeout)", msg, now.tv_sec, now.tv_usec, buf); } } Index: tools.c =================================================================== RCS file: /cvsroot/srvx/services/src/tools.c,v retrieving revision 1.126 retrieving revision 1.127 diff -C2 -r1.126 -r1.127 *** tools.c 18 Aug 2003 19:36:47 -0000 1.126 --- tools.c 26 Sep 2003 15:16:58 -0000 1.127 *************** *** 84,88 **** int irccasecmp(const unsigned char *stra, const unsigned char *strb) { ! while (*stra && (irc_tolower[*stra] == irc_tolower[*strb])) stra++, strb++; return irc_tolower[*stra] - irc_tolower[*strb]; } --- 84,89 ---- int irccasecmp(const unsigned char *stra, const unsigned char *strb) { ! while (*stra && (irc_tolower[*stra] == irc_tolower[*strb])) ! stra++, strb++; return irc_tolower[*stra] - irc_tolower[*strb]; } *************** *** 91,95 **** ircncasecmp(const unsigned char *stra, const unsigned char *strb, unsigned int len) { len--; ! while (*stra && (irc_tolower[*stra] == irc_tolower[*strb]) && len) stra++, strb++, len--; return irc_tolower[*stra] - irc_tolower[*strb]; } --- 92,97 ---- ircncasecmp(const unsigned char *stra, const unsigned char *strb, unsigned int len) { len--; ! while (*stra && (irc_tolower[*stra] == irc_tolower[*strb]) && len) ! stra++, strb++, len--; return irc_tolower[*stra] - irc_tolower[*strb]; } *************** *** 98,105 **** irccasestr(const unsigned char *haystack, const unsigned char *needle) { unsigned int hay_len = strlen(haystack), needle_len = strlen(needle), pos; ! if (hay_len < needle_len) return NULL; for (pos=0; pos<hay_len+1-needle_len; ++pos) { if ((irc_tolower[haystack[pos]] == irc_tolower[*needle]) ! && !ircncasecmp(haystack+pos, needle, needle_len)) return haystack+pos; } return NULL; --- 100,109 ---- irccasestr(const unsigned char *haystack, const unsigned char *needle) { unsigned int hay_len = strlen(haystack), needle_len = strlen(needle), pos; ! if (hay_len < needle_len) ! return NULL; for (pos=0; pos<hay_len+1-needle_len; ++pos) { if ((irc_tolower[haystack[pos]] == irc_tolower[*needle]) ! && !ircncasecmp(haystack+pos, needle, needle_len)) ! return haystack+pos; } return NULL; *************** *** 118,124 **** break; } ! if (!*line) break; argv[argc++] = line; ! if (argc >= argv_size) break; while (*line != ' ' && *line) line++; } --- 122,130 ---- break; } ! if (!*line) ! break; argv[argc++] = line; ! if (argc >= argv_size) ! break; while (*line != ' ' && *line) line++; } |