]> git.ipfire.org Git - thirdparty/git.git/commitdiff
git-compat-util.h: drop trailing semicolon from macro definition
authorRené Scharfe <l.s.r@web.de>
Sat, 13 Mar 2021 16:10:47 +0000 (17:10 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sat, 13 Mar 2021 23:56:13 +0000 (15:56 -0800)
Make CALLOC_ARRAY usable like a function by requiring callers to supply
the trailing semicolon, which all of the current ones already do.  With
the extra semicolon e.g. the following code wouldn't compile because it
disconnects the "else" from the "if":

if (condition)
CALLOC_ARRAY(ptr, n);
else
whatever();

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-compat-util.h

index 3b2738c73d769ce4edb515bcad6ee015d4041ebd..dcc786edaab9dce2276edd1268cfd20b5c048778 100644 (file)
@@ -898,7 +898,7 @@ int xstrncmpz(const char *s, const char *t, size_t len);
 #define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
 
 #define ALLOC_ARRAY(x, alloc) (x) = xmalloc(st_mult(sizeof(*(x)), (alloc)))
-#define CALLOC_ARRAY(x, alloc) (x) = xcalloc((alloc), sizeof(*(x)));
+#define CALLOC_ARRAY(x, alloc) (x) = xcalloc((alloc), sizeof(*(x)))
 #define REALLOC_ARRAY(x, alloc) (x) = xrealloc((x), st_mult(sizeof(*(x)), (alloc)))
 
 #define COPY_ARRAY(dst, src, n) copy_array((dst), (src), (n), sizeof(*(dst)) + \