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

Comparing ircd-hybrid/trunk/src/conf_class.c (file contents):
Revision 2213 by michael, Wed Jun 5 22:25:49 2013 UTC vs.
Revision 3547 by michael, Fri May 16 11:21:48 2014 UTC

# Line 1 | Line 1
1   /*
2 < *  ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
2 > *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3   *
4 < *  Copyright (C) 2002 by the past and present ircd coders, and others.
4 > *  Copyright (c) 1997-2014 ircd-hybrid development team
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 19 | Line 19
19   *  USA
20   */
21  
22 < /*! \file
22 > /*! \file conf_class.c
23   * \brief Configuration managment for class{} blocks
24   * \version $Id$
25   */
# Line 35 | Line 35
35  
36   struct ClassItem *class_default;
37  
38 < static dlink_list class_list = { NULL, NULL, 0 };
38 > static dlink_list class_list;
39  
40  
41   const dlink_list *
# Line 47 | Line 47 | class_get_list(void)
47   struct ClassItem *
48   class_make(void)
49   {
50 <  struct ClassItem *class = MyMalloc(sizeof(*class));
50 >  struct ClassItem *class = MyCalloc(sizeof(*class));
51  
52    class->active    = 1;
53    class->con_freq  = DEFAULT_CONNECTFREQUENCY;
# Line 64 | Line 64 | class_make(void)
64   void
65   class_free(struct ClassItem *class)
66   {
67 <  assert(class);
67 >  assert(class != class_default);
68    assert(class->active    == 0);
69    assert(class->ref_count == 0);
70  
# Line 258 | Line 258 | cidr_limit_reached(int over_rule, struct
258        }
259      }
260  
261 <    cidr = MyMalloc(sizeof(struct CidrItem));
261 >    cidr = MyCalloc(sizeof(struct CidrItem));
262      cidr->number_on_this_cidr = 1;
263      cidr->mask = *ip;
264      mask_addr(&cidr->mask, class->cidr_bitlen_ipv4);
# Line 281 | Line 281 | cidr_limit_reached(int over_rule, struct
281        }
282      }
283  
284 <    cidr = MyMalloc(sizeof(struct CidrItem));
284 >    cidr = MyCalloc(sizeof(struct CidrItem));
285      cidr->number_on_this_cidr = 1;
286      cidr->mask = *ip;
287      mask_addr(&cidr->mask, class->cidr_bitlen_ipv6);
# Line 357 | Line 357 | remove_from_cidr_check(struct irc_ssaddr
357   void
358   rebuild_cidr_list(struct ClassItem *class)
359   {
360 <  dlink_node *ptr;
360 >  dlink_node *ptr = NULL;
361  
362    destroy_cidr_class(class);
363  
# Line 382 | Line 382 | rebuild_cidr_list(struct ClassItem *clas
382   static void
383   destroy_cidr_list(dlink_list *list)
384   {
385 <  dlink_node *ptr = NULL, *next_ptr = NULL;
385 >  dlink_node *ptr = NULL, *ptr_next = NULL;
386  
387 <  DLINK_FOREACH_SAFE(ptr, next_ptr, list->head)
387 >  DLINK_FOREACH_SAFE(ptr, ptr_next, list->head)
388    {
389      dlinkDelete(ptr, list);
390      MyFree(ptr->data);

Diff Legend

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