ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/motd.c
(Generate patch)

Comparing ircd-hybrid/trunk/src/motd.c (file contents):
Revision 7934 by michael, Fri Jan 27 14:29:17 2017 UTC vs.
Revision 8310 by michael, Wed Feb 28 16:46:13 2018 UTC

# Line 2 | Line 2
2   *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3   *
4   *  Copyright (c) 2000 Kevin L. Mitchell <klmitch@mit.edu>
5 < *  Copyright (c) 2013-2017 ircd-hybrid development team
5 > *  Copyright (c) 2013-2018 ircd-hybrid development team
6   *
7   *  This program is free software; you can redistribute it and/or modify
8   *  it under the terms of the GNU General Public License as published by
# Line 57 | Line 57 | static struct
57   static struct Motd *
58   motd_create(const char *mask, const char *path)
59   {
60 <  struct Motd *motd = xcalloc(sizeof(struct Motd));
60 >  struct Motd *motd = xcalloc(sizeof(*motd));
61  
62    if (EmptyString(mask))
63      motd->type = MOTD_UNIVERSAL;
# Line 140 | Line 140 | motd_cache(struct Motd *motd)
140    }
141  
142    /* Ok, allocate a structure; we'll realloc later to trim memory */
143 <  struct MotdCache *cache = xcalloc(sizeof(struct MotdCache) + (MOTD_LINESIZE * MOTD_MAXLINES));
143 >  struct MotdCache *cache = xcalloc(sizeof(*cache) + (MOTD_LINESIZE * MOTD_MAXLINES));
144    cache->ref = 1;
145    cache->path = xstrdup(motd->path);
146    cache->maxcount = motd->maxcount;
# Line 159 | Line 159 | motd_cache(struct Motd *motd)
159    fclose(file);  /* Close the file */
160  
161    /* Trim memory usage a little */
162 <  motd->cache = xcalloc(sizeof(struct MotdCache) + (MOTD_LINESIZE * cache->count));
163 <  memcpy(motd->cache, cache, sizeof(struct MotdCache) + (MOTD_LINESIZE * cache->count));
162 >  motd->cache = xcalloc(sizeof(*motd->cache) + (MOTD_LINESIZE * cache->count));
163 >  memcpy(motd->cache, cache, sizeof(*motd->cache) + (MOTD_LINESIZE * cache->count));
164    xfree(cache);
165  
166    /* Now link it in */
# Line 247 | Line 247 | motd_lookup(const struct Client *client_
247            return motd;
248          break;
249        case MOTD_IPMASKV4:
250 <          if (client_p->connection->aftype == AF_INET)
251 <            if (match_ipv4(&client_p->connection->ip, &motd->address, motd->addrbits))
252 <              return motd;
250 >        if (client_p->connection->aftype == AF_INET)
251 >          if (match_ipv4(&client_p->connection->ip, &motd->address, motd->addrbits))
252 >            return motd;
253          break;
254        case MOTD_IPMASKV6:
255 <          if (client_p->connection->aftype == AF_INET6)
256 <            if (match_ipv6(&client_p->connection->ip, &motd->address, motd->addrbits))
257 <              return motd;
255 >        if (client_p->connection->aftype == AF_INET6)
256 >          if (match_ipv6(&client_p->connection->ip, &motd->address, motd->addrbits))
257 >            return motd;
258          break;
259        default: break;
260      }

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)