summaryrefslogtreecommitdiff
path: root/lib/bumpalloc.h
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1998-08-15 14:20:16 +0000
committerJim Meyering <jim@meyering.net>1998-08-15 14:20:16 +0000
commitd68269bb5503396a35f9c42f4455d860e8bcafa2 (patch)
tree957f09d5efb4ace8121fcd081d26b0badfaae2fb /lib/bumpalloc.h
parent2aa62088a3d9f429d24bf60587b482f35b01fee6 (diff)
downloadcoreutils-d68269bb5503396a35f9c42f4455d860e8bcafa2.tar.xz
Add braces to suppress warning about ambiguous `else'.
Diffstat (limited to 'lib/bumpalloc.h')
-rw-r--r--lib/bumpalloc.h20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/bumpalloc.h b/lib/bumpalloc.h
index ce37d1c68..139cd8a3e 100644
--- a/lib/bumpalloc.h
+++ b/lib/bumpalloc.h
@@ -1,5 +1,5 @@
/* BUMP_ALLOC macro - increase table allocation by one element.
- Copyright (C) 1990, 1991, 1993 Free Software Foundation, Inc.
+ Copyright (C) 1990, 1991, 1993, 1998 Free Software Foundation, Inc.
François Pinard <pinard@iro.umontreal.ca>, 1990.
This program is free software; you can redistribute it and/or modify
@@ -27,12 +27,12 @@
/* Routines `xmalloc' and `xrealloc' are called to do the actual memory
management. This implies that the program will abort with an `Memory
exhausted!' error if any problem arise.
-
+
To work correctly, at least EXPONENT and TYPE should always be the
same for all uses of this macro for any given TABLE. A secure way to
achieve this is to never use this macro directly, but use it to define
other macros, which would then be TABLE-specific.
-
+
The first time through, COUNT is usually zero. Note that COUNT is not
updated by this macro, but it should be update elsewhere, later. This
is convenient, because it allows TABLE[COUNT] to refer to the new
@@ -48,14 +48,16 @@
SIZE argument. The EXPONENT, TYPE and SIZE parameters should still
have the same value for all macro calls related to a specific TABLE. */
-#define BUMP_ALLOC_WITH_SIZE(Table, Count, Exponent, Type, Size) \
+#define BUMP_ALLOC_WITH_SIZE(Table, Count, Exponent, Type, Size) \
do \
{ \
if (((Count) & (~(~0 << (Exponent)))) == 0) \
- if ((Count) == 0) \
- (Table) = (Type *) xmalloc ((1 << (Exponent)) * (Size)); \
- else \
- (Table) = (Type *) \
- xrealloc ((Table), ((Count) + (1 << (Exponent))) * (Size)); \
+ { \
+ if ((Count) == 0) \
+ (Table) = (Type *) xmalloc ((1 << (Exponent)) * (Size)); \
+ else \
+ (Table) = (Type *) \
+ xrealloc ((Table), ((Count) + (1 << (Exponent))) * (Size)); \
+ } \
} \
while (0)