obstack.c: Fix some sparse warnings

In particular, sparse issues the following warnings: compat/obstack.c:176:17: warning: Using plain integer as NULL pointer compat/obstack.c:224:17: warning: Using plain integer as NULL pointer compat/obstack.c:324:16: warning: Using plain integer as NULL pointer compat/obstack.c:329:16: warning: Using plain integer as NULL pointer compat/obstack.c:347:16: warning: Using plain integer as NULL pointer compat/obstack.c:362:19: warning: Using plain integer as NULL pointer compat/obstack.c:379:29: warning: Using plain integer as NULL pointer compat/obstack.c:399:1: error: symbol 'print_and_abort' redeclared with \ different type (originally declared at compat/obstack.c:95) \ - different modifiers Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ramsay Jones committed Sep 11, 2011 at 20:26 UTC 3254310863d6964f5b750a373b9e5598ce529381
1 file changed +7 -8
compat/obstack.c
+7 -8
@@ -173,7 +173,7 @@ _obstack_begin (struct obstack *h,
173 alignment - 1);
174 h->chunk_limit = chunk->limit
175 = (char *) chunk + h->chunk_size;
176 - chunk->prev = 0;
176 + chunk->prev = NULL;
177 /* The initial chunk now contains no empty object. */
178 h->maybe_empty_object = 0;
179 h->alloc_failed = 0;
@@ -221,7 +221,7 @@ _obstack_begin_1 (struct obstack *h, int size, int alignment,
221 alignment - 1);
222 h->chunk_limit = chunk->limit
223 = (char *) chunk + h->chunk_size;
224 - chunk->prev = 0;
224 + chunk->prev = NULL;
225 /* The initial chunk now contains no empty object. */
226 h->maybe_empty_object = 0;
227 h->alloc_failed = 0;
@@ -321,12 +321,12 @@ _obstack_allocated_p (struct obstack *h, void *obj)
321 /* We use >= rather than > since the object cannot be exactly at
322 the beginning of the chunk but might be an empty object exactly
323 at the end of an adjacent chunk. */
324 - while (lp != 0 && ((void *) lp >= obj || (void *) (lp)->limit < obj))
324 + while (lp != NULL && ((void *) lp >= obj || (void *) (lp)->limit < obj))
325 {
326 plp = lp->prev;
327 lp = plp;
328 }
329 - return lp != 0;
329 + return lp != NULL;
330 }
331
332 /* Free objects in obstack H, including OBJ and everything allocate
@@ -344,7 +344,7 @@ obstack_free (struct obstack *h, void *obj)
344 /* We use >= because there cannot be an object at the beginning of a chunk.
345 But there can be an empty object at that address
346 at the end of another chunk. */
347 - while (lp != 0 && ((void *) lp >= obj || (void *) (lp)->limit < obj))
347 + while (lp != NULL && ((void *) lp >= obj || (void *) (lp)->limit < obj))
348 {
349 plp = lp->prev;
350 CALL_FREEFUN (h, lp);
@@ -359,7 +359,7 @@ obstack_free (struct obstack *h, void *obj)
359 h->chunk_limit = lp->limit;
360 h->chunk = lp;
361 }
362 - else if (obj != 0)
362 + else if (obj != NULL)
363 /* obj is not in any of the chunks! */
364 abort ();
365 }
@@ -376,7 +376,7 @@ _obstack_memory_used (struct obstack *h)
376 register struct _obstack_chunk* lp;
377 register int nbytes = 0;
378
379 - for (lp = h->chunk; lp != 0; lp = lp->prev)
379 + for (lp = h->chunk; lp != NULL; lp = lp->prev)
380 {
381 nbytes += lp->limit - (char *) lp;
382 }
@@ -395,7 +395,6 @@ _obstack_memory_used (struct obstack *h)
395 # endif
396
397 static void
398 -__attribute__ ((noreturn))
398 print_and_abort (void)
399 {
400 /* Don't change any of these strings. Yes, it would be possible to add