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

Comparing ircd-hybrid/trunk/src/patricia.c (file contents):
Revision 7031 by michael, Thu Oct 22 18:35:52 2015 UTC vs.
Revision 7032 by michael, Sun Jan 3 14:34:39 2016 UTC

# Line 199 | Line 199 | New_Prefix2 (int family, void *dest, int
199      if (family == AF_INET6) {
200          default_bitlen = sizeof(struct in6_addr) * 8;
201          if (prefix == NULL) {
202 <            prefix = MyCalloc(sizeof (prefix_t));
202 >            prefix = xcalloc(sizeof (prefix_t));
203              dynamic_allocated++;
204          }
205          memcpy (&prefix->add.sin6, dest, sizeof(struct in6_addr));
206      }
207      else if (family == AF_INET) {
208          if (prefix == NULL) {
209 <            prefix = MyCalloc(sizeof (prefix4_t));
209 >            prefix = xcalloc(sizeof (prefix4_t));
210              dynamic_allocated++;
211          }
212          memcpy (&prefix->add.sin, dest, sizeof(struct in_addr));
# Line 331 | Line 331 | static int num_active_patricia = 0;
331   patricia_tree_t *
332   New_Patricia (int maxbits)
333   {
334 <    patricia_tree_t *patricia = MyCalloc(sizeof *patricia);
334 >    patricia_tree_t *patricia = xcalloc(sizeof *patricia);
335  
336      patricia->maxbits = maxbits;
337      patricia->head = NULL;
# Line 369 | Line 369 | Clear_Patricia (patricia_tree_t *patrici
369              else {
370                  assert (Xrn->data == NULL);
371              }
372 <            MyFree (Xrn);
372 >            xfree (Xrn);
373              patricia->num_active_node--;
374  
375              if (l) {
# Line 387 | Line 387 | Clear_Patricia (patricia_tree_t *patrici
387          }
388      }
389      assert (patricia->num_active_node == 0);
390 <    /* MyFree (patricia); */
390 >    /* xfree (patricia); */
391   }
392  
393  
# Line 395 | Line 395 | void
395   Destroy_Patricia (patricia_tree_t *patricia, void_fn_t func)
396   {
397      Clear_Patricia (patricia, func);
398 <    MyFree (patricia);
398 >    xfree (patricia);
399      num_active_patricia--;
400   }
401  
# Line 599 | Line 599 | patricia_lookup (patricia_tree_t *patric
599      assert (prefix->bitlen <= patricia->maxbits);
600  
601      if (patricia->head == NULL) {
602 <        node = MyCalloc(sizeof *node);
602 >        node = xcalloc(sizeof *node);
603          node->bit = prefix->bitlen;
604          node->prefix = Ref_Prefix (prefix);
605          node->parent = NULL;
# Line 710 | Line 710 | patricia_lookup (patricia_tree_t *patric
710          return (node);
711      }
712  
713 <    new_node = MyCalloc(sizeof *new_node);
713 >    new_node = xcalloc(sizeof *new_node);
714      new_node->bit = prefix->bitlen;
715      new_node->prefix = Ref_Prefix (prefix);
716      new_node->parent = NULL;
# Line 762 | Line 762 | patricia_lookup (patricia_tree_t *patric
762   #endif /* PATRICIA_DEBUG */
763      }
764      else {
765 <        glue = MyCalloc(sizeof *glue);
765 >        glue = xcalloc(sizeof *glue);
766          glue->bit = differ_bit;
767          glue->prefix = NULL;
768          glue->parent = node->parent;
# Line 830 | Line 830 | patricia_remove (patricia_tree_t *patric
830   #endif /* PATRICIA_DEBUG */
831          parent = node->parent;
832          Deref_Prefix (node->prefix);
833 <        MyFree (node);
833 >        xfree (node);
834          patricia->num_active_node--;
835  
836          if (parent == NULL) {
# Line 866 | Line 866 | patricia_remove (patricia_tree_t *patric
866              parent->parent->l = child;
867          }
868          child->parent = parent->parent;
869 <        MyFree (parent);
869 >        xfree (parent);
870          patricia->num_active_node--;
871          return;
872      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines