Skip to content

Commit 5de3de3

Browse files
jonathantanmygitster
authored andcommitted
git-compat-util: make UNLEAK less error-prone
Commit 0e5bba5 ("add UNLEAK annotation for reducing leak false positives", 2017-09-08) introduced an UNLEAK macro to be used as "UNLEAK(var);", but its existing definitions leave semicolons that act as empty statements, which will lead to syntax errors, e.g. if (condition) UNLEAK(var); else something_else(var); would be broken with two statements between if (condition) and else. Lose the excess semicolon from the end of the macro replacement text. Signed-off-by: Jonathan Tan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0e5bba5 commit 5de3de3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

git-compat-util.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,9 +1184,9 @@ extern int cmd_main(int, const char **);
11841184
*/
11851185
#ifdef SUPPRESS_ANNOTATED_LEAKS
11861186
extern void unleak_memory(const void *ptr, size_t len);
1187-
#define UNLEAK(var) unleak_memory(&(var), sizeof(var));
1187+
#define UNLEAK(var) unleak_memory(&(var), sizeof(var))
11881188
#else
1189-
#define UNLEAK(var)
1189+
#define UNLEAK(var) do {} while (0)
11901190
#endif
11911191

11921192
#endif

0 commit comments

Comments
 (0)