From: Ted Lemon Date: Fri, 7 May 1999 17:36:36 +0000 (+0000) Subject: Enclose abort() calls in POINTER_DEBUG ifdefs and just return otherwise. X-Git-Tag: V3-ALPHA-19990507~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e0a40b8d9fdab56dce1417a1861bf7f6f8610ca;p=thirdparty%2Fdhcp.git Enclose abort() calls in POINTER_DEBUG ifdefs and just return otherwise. --- diff --git a/common/alloc.c b/common/alloc.c index 623c87958..481c3311a 100644 --- a/common/alloc.c +++ b/common/alloc.c @@ -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; diff --git a/common/memory.c b/common/memory.c index e7edab775..092c079cd 100644 --- a/common/memory.c +++ b/common/memory.c @@ -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; } } diff --git a/common/options.c b/common/options.c index ff3d8629e..246b983be 100644 --- a/common/options.c +++ b/common/options.c @@ -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--;