]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Enclose abort() calls in POINTER_DEBUG ifdefs and just return otherwise.
authorTed Lemon <source@isc.org>
Fri, 7 May 1999 17:36:36 +0000 (17:36 +0000)
committerTed Lemon <source@isc.org>
Fri, 7 May 1999 17:36:36 +0000 (17:36 +0000)
common/alloc.c
common/memory.c
common/options.c

index 623c87958a598c24d7665cdf79458362eb04197f..481c3311a391100b95d1c4da1b335e00a06c7706 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: alloc.c,v 1.28 1999/04/05 19:02:17 mellon Exp $ Copyright (c) 1995, 1996, 1998 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: alloc.c,v 1.29 1999/05/07 17:34:30 mellon Exp $ Copyright (c) 1995, 1996, 1998 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -471,12 +471,20 @@ int expression_reference (ptr, src, name)
 {
        if (!ptr) {
                log_error ("Null pointer in expression_reference: %s", name);
+#if defined (POINTER_DEBUG)
                abort ();
+#else
+               return 0;
+#endif
        }
        if (*ptr) {
                log_error ("Non-null pointer in expression_reference (%s)",
                      name);
+#if defined (POINTER_DEBUG)
                abort ();
+#else
+               return 0;
+#endif
        }
        *ptr = src;
        src -> refcnt++;
@@ -511,12 +519,20 @@ int option_cache_reference (ptr, src, name)
 {
        if (!ptr) {
                log_error ("Null pointer in option_cache_reference: %s", name);
+#if defined (POINTER_DEBUG)
                abort ();
+#else
+               return 0;
+#endif
        }
        if (*ptr) {
                log_error ("Non-null pointer in option_cache_reference (%s)",
                      name);
+#if defined (POINTER_DEBUG)
                abort ();
+#else
+               return 0;
+#endif
        }
        *ptr = src;
        src -> refcnt++;
@@ -546,11 +562,19 @@ int buffer_reference (ptr, bp, name)
        if (!ptr) {
                log_error ("Null pointer passed to buffer_reference: %s",
                           name);
+#if defined (POINTER_DEBUG)
                abort ();
+#else
+               return 0;
+#endif
        }
        if (*ptr) {
                log_error ("Non-null pointer in buffer_reference (%s)", name);
+#if defined (POINTER_DEBUG)
                abort ();
+#else
+               return 0;
+#endif
        }
        *ptr = bp;
        bp -> refcnt++;
@@ -566,7 +590,11 @@ int buffer_dereference (ptr, name)
        if (!ptr || !*ptr) {
                log_error ("Null pointer passed to buffer_dereference: %s",
                           name);
+#if defined (POINTER_DEBUG)
                abort ();
+#else
+               return 0;
+#endif
        }
 
        (*ptr) -> refcnt--;
@@ -600,12 +628,20 @@ int dns_host_entry_reference (ptr, bp, name)
        if (!ptr) {
                log_error ("Null pointer in dns_host_entry_reference: %s",
                           name);
+#if defined (POINTER_DEBUG)
                abort ();
+#else
+               return 0;
+#endif
        }
        if (*ptr) {
                log_error ("Non-null pointer in dns_host_entry_reference (%s)",
                           name);
+#if defined (POINTER_DEBUG)
                abort ();
+#else
+               return 0;
+#endif
        }
        *ptr = bp;
        bp -> refcnt++;
@@ -621,7 +657,11 @@ int dns_host_entry_dereference (ptr, name)
        if (!ptr || !*ptr) {
                log_error ("Null pointer in dns_host_entry_dereference: %s",
                           name);
+#if defined (POINTER_DEBUG)
                abort ();
+#else
+               return 0;
+#endif
        }
 
        (*ptr) -> refcnt--;
@@ -640,12 +680,20 @@ int option_state_allocate (ptr, name)
        if (!ptr) {
                log_error ("Null pointer passed to option_state_allocate: %s",
                           name);
+#if defined (POINTER_DEBUG)
                abort ();
+#else
+               return 0;
+#endif
        }
        if (*ptr) {
                log_error ("Non-null pointer in option_state_allocate (%s)",
                           name);
+#if defined (POINTER_DEBUG)
                abort ();
+#else
+               return 0;
+#endif
        }
 
        size = sizeof **ptr + (universe_count - 1) * sizeof (VOIDPTR);
@@ -667,12 +715,20 @@ int option_state_reference (ptr, bp, name)
        if (!ptr) {
                log_error ("Null pointer in option_state_reference: %s",
                           name);
+#if defined (POINTER_DEBUG)
                abort ();
+#else
+               return 0;
+#endif
        }
        if (*ptr) {
                log_error ("Non-null pointer in option_state_reference (%s)",
                           name);
+#if defined (POINTER_DEBUG)
                abort ();
+#else
+               return 0;
+#endif
        }
        *ptr = bp;
        bp -> refcnt++;
@@ -689,7 +745,11 @@ int option_state_dereference (ptr, name)
        if (!ptr || !*ptr) {
                log_error ("Null pointer in option_state_dereference: %s",
                           name);
+#if defined (POINTER_DEBUG)
                abort ();
+#else
+               return 0;
+#endif
        }
 
        options = *ptr;
index e7edab775080831c935c5c4c1335443c8a984597..092c079cd304d9f5e85c48ab1bb2e744c0b1c3fa 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: memory.c,v 1.48 1999/03/16 05:50:35 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: memory.c,v 1.49 1999/05/07 17:35:12 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -733,11 +733,6 @@ void uid_hash_add (lease)
                find_lease_by_uid (lease -> uid, lease -> uid_len);
        struct lease *scan;
 
-#ifdef DEBUG
-       if (lease -> n_uid)
-               abort ();
-#endif
-
        /* If it's not in the hash, just add it. */
        if (!head)
                add_hash (lease_uid_hash, lease -> uid,
@@ -745,11 +740,7 @@ void uid_hash_add (lease)
        else {
                /* Otherwise, attach it to the end of the list. */
                for (scan = head; scan -> n_uid; scan = scan -> n_uid)
-#ifdef DEBUG
-                       if (scan == lease)
-                               abort ()
-#endif
-                                       ;
+                       ;
                scan -> n_uid = lease;
        }
 }
index ff3d8629e9b89a12261dfb7c4307b65fada516fd..246b983be8ed42bd5d01fe863aee8e8f273e8ff2 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: options.c,v 1.41 1999/04/23 22:10:52 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: options.c,v 1.42 1999/05/07 17:36:36 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #define DHCP_OPTION_DATA
@@ -1125,7 +1125,11 @@ int option_cache_dereference (ptr, name)
        if (!ptr || !*ptr) {
                log_error ("Null pointer in option_cache_dereference: %s",
                           name);
+#if defined (POINTER_DEBUG)
                abort ();
+#else
+               return 0;
+#endif
        }
 
        (*ptr) -> refcnt--;