diff options
author | michael <michael@82007160-df01-0410-b94d-b575c5fd34c7> | 2013-04-15 09:09:09 +0000 |
---|---|---|
committer | michael <michael@82007160-df01-0410-b94d-b575c5fd34c7> | 2013-04-15 09:09:09 +0000 |
commit | 9acb4d06a759c067c846b8fd29f825556667dbf9 (patch) | |
tree | f3e5c0fa2568c5c549ece8a30d2df562c9276bd1 /src | |
parent | 186e3840dc0e313bf4bd2f91555a2dc5b7649ef6 (diff) |
- Minor cleanups to hash.c; removed now unused functions, style cleanups
git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/trunk@1826 82007160-df01-0410-b94d-b575c5fd34c7
Diffstat (limited to 'src')
-rw-r--r-- | src/channel.c | 3 | ||||
-rw-r--r-- | src/hash.c | 82 |
2 files changed, 6 insertions, 79 deletions
diff --git a/src/channel.c b/src/channel.c index 5ee5977..ac31a36 100644 --- a/src/channel.c +++ b/src/channel.c @@ -42,6 +42,7 @@ #include "memory.h" #include "mempool.h" #include "s_misc.h" +#include "resv.h" struct config_channel_entry ConfigChannel; dlink_list global_channel_list = { NULL, NULL, 0 }; @@ -718,7 +719,7 @@ can_send(struct Channel *chptr, struct Client *source_p, struct Membership *ms) if (MyClient(source_p) && !IsExemptResv(source_p)) if (!(HasUMode(source_p, UMODE_OPER) && ConfigFileEntry.oper_pass_resv)) - if (!hash_find_resv(chptr->chname) == ConfigChannel.restrict_channels) + if (!match_find_resv(chptr->chname) == ConfigChannel.restrict_channels) return ERR_CANNOTSENDTOCHAN; if (ms != NULL || (ms = find_channel_link(source_p, chptr))) @@ -57,7 +57,6 @@ static struct Client *idTable[HASHSIZE]; static struct Client *clientTable[HASHSIZE]; static struct Channel *channelTable[HASHSIZE]; static struct UserHost *userhostTable[HASHSIZE]; -static struct MaskItem *resvchannelTable[HASHSIZE]; /* init_hash() @@ -93,7 +92,7 @@ strhash(const char *name) const unsigned char *p = (const unsigned char *)name; unsigned int hval = FNV1_32_INIT; - if (*p == '\0') + if (EmptyString(p)) return 0; for (; *p != '\0'; ++p) { @@ -153,15 +152,6 @@ hash_add_channel(struct Channel *chptr) } void -hash_add_resv(struct MaskItem *conf) -{ - unsigned int hashv = strhash(conf->name); - - conf->hnext = resvchannelTable[hashv]; - resvchannelTable[hashv] = conf; -} - -void hash_add_userhost(struct UserHost *userhost) { unsigned int hashv = strhash(userhost->host); @@ -304,31 +294,6 @@ hash_del_channel(struct Channel *chptr) } } -void -hash_del_resv(struct MaskItem *chptr) -{ - unsigned int hashv = strhash(chptr->name); - struct MaskItem *tmp = resvchannelTable[hashv]; - - if (tmp != NULL) - { - if (tmp == chptr) - { - resvchannelTable[hashv] = chptr->hnext; - chptr->hnext = chptr; - } - else - { - while (tmp->hnext != chptr) - if ((tmp = tmp->hnext) == NULL) - return; - - tmp->hnext = tmp->hnext->hnext; - chptr->hnext = chptr; - } - } -} - /* hash_find_client() * * inputs - pointer to name @@ -493,9 +458,6 @@ hash_get_bucket(int type, unsigned int hashv) case HASH_TYPE_USERHOST: return userhostTable[hashv]; break; - case HASH_TYPE_RESERVED: - return resvchannelTable[hashv]; - break; default: assert(0); } @@ -503,42 +465,6 @@ hash_get_bucket(int type, unsigned int hashv) return NULL; } -/* hash_find_resv() - * - * inputs - pointer to name - * output - NONE - * side effects - New semantics: finds a reserved channel whose name is 'name', - * if can't find one returns NULL, if can find it moves - * it to the top of the list and returns it. - */ -struct MaskItem * -hash_find_resv(const char *name) -{ - unsigned int hashv = strhash(name); - struct MaskItem *chptr; - - if ((chptr = resvchannelTable[hashv]) != NULL) - { - if (irccmp(name, chptr->name)) - { - struct MaskItem *prev; - - while (prev = chptr, (chptr = chptr->hnext) != NULL) - { - if (!irccmp(name, chptr->name)) - { - prev->hnext = chptr->hnext; - chptr->hnext = resvchannelTable[hashv]; - resvchannelTable[hashv] = chptr; - break; - } - } - } - } - - return chptr; -} - struct UserHost * hash_find_userhost(const char *host) { @@ -781,7 +707,7 @@ exceeding_sendq(struct Client *to) void free_list_task(struct ListTask *lt, struct Client *source_p) { - dlink_node *dl, *dln; + dlink_node *dl = NULL, *dln = NULL; if ((dl = dlinkFindDelete(&listing_client_list, source_p)) != NULL) free_dlink_node(dl); @@ -813,9 +739,9 @@ free_list_task(struct ListTask *lt, struct Client *source_p) * side effects - */ static int -list_allow_channel(const char *chname, struct ListTask *lt) +list_allow_channel(const char *chname, const struct ListTask *lt) { - dlink_node *dl = NULL; + const dlink_node *dl = NULL; DLINK_FOREACH(dl, lt->show_mask.head) if (match(dl->data, chname) != 0) |