We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent df4448f commit 3db53ebCopy full SHA for 3db53eb
src/common.h
@@ -121,12 +121,16 @@
121
/**
122
* Check a pointer allocation result, returning -1 if it failed.
123
*/
124
-#define GIT_ERROR_CHECK_ALLOC(ptr) if (ptr == NULL) { return -1; }
+#define GIT_ERROR_CHECK_ALLOC(ptr) do { \
125
+ if ((ptr) == NULL) { return -1; } \
126
+ } while(0)
127
128
129
* Check a string buffer allocation result, returning -1 if it failed.
130
-#define GIT_ERROR_CHECK_ALLOC_STR(buf) if ((void *)(buf) == NULL || git_str_oom(buf)) { return -1; }
131
+#define GIT_ERROR_CHECK_ALLOC_STR(buf) do { \
132
+ if ((void *)(buf) == NULL || git_str_oom(buf)) { return -1; } \
133
134
135
136
* Check a return value and propagate result if non-zero.
0 commit comments