changeset 40217:a315d09bcec4

alloca, tsearch-tests: Write NULL for the null pointer. * lib/alloca.c (i00afunc): Write NULL instead of 0. * tests/test-tsearch.c (mangle_tree): Likewise.
author Michal Privoznik <mprivozn@redhat.com>
date Sun, 03 Mar 2019 19:34:57 +0100
parents 02ed6264c100
children e92cc6824b7f
files ChangeLog lib/alloca.c tests/test-tsearch.c
diffstat 3 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Mar 09 23:30:40 2019 +0100
+++ b/ChangeLog	Sun Mar 03 19:34:57 2019 +0100
@@ -1,3 +1,9 @@
+2019-02-28  Michal Privoznik  <mprivozn@redhat.com>
+
+	alloca, tsearch-tests: Write NULL for the null pointer.
+	* lib/alloca.c (i00afunc): Write NULL instead of 0.
+	* tests/test-tsearch.c (mangle_tree): Likewise.
+
 2019-03-09  Bruno Haible  <bruno@clisp.org>
 
 	strfmon_l: Fix -fsanitize=address finding.
--- a/lib/alloca.c	Sat Mar 09 23:30:40 2019 +0100
+++ b/lib/alloca.c	Sun Mar 03 19:34:57 2019 +0100
@@ -350,16 +350,16 @@
   /* There must be at least one stack segment.  Therefore it is
      a fatal error if "trailer" is null.  */
 
-  if (trailer == 0)
+  if (trailer == NULL)
     abort ();
 
   /* Discard segments that do not contain our argument address.  */
 
-  while (trailer != 0)
+  while (trailer != NULL)
     {
       block = (long *) trailer->this_address;
       size = trailer->this_size;
-      if (block == 0 || size == 0)
+      if (block == NULL || size == 0)
         abort ();
       trailer = (struct stk_trailer *) trailer->link;
       if ((block <= address) && (address < (block + size)))
@@ -371,7 +371,7 @@
 
   result = address - block;
 
-  if (trailer == 0)
+  if (trailer == NULL)
     {
       return result;
     }
@@ -383,7 +383,7 @@
       result += trailer->this_size;
       trailer = (struct stk_trailer *) trailer->link;
     }
-  while (trailer != 0);
+  while (trailer != NULL);
 
   /* We are done.  Note that if you present a bogus address (one
      not in any segment), you will get a different number back, formed
--- a/tests/test-tsearch.c	Sat Mar 09 23:30:40 2019 +0100
+++ b/tests/test-tsearch.c	Sun Mar 03 19:34:57 2019 +0100
@@ -223,7 +223,7 @@
                   error = 1;
                 }
               elem = tsearch (x + j, root, cmp_fn);
-              if (elem == 0
+              if (elem == NULL
                   || tfind (x + j, (void *const *) root, cmp_fn) == NULL)
                 {
                   fputs ("Couldn't find element after it was added.\n",