chiark / gitweb /
util: make malloc0 ask calloc for one block of size n
authorThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Fri, 28 Aug 2015 19:16:39 +0000 (21:16 +0200)
committerSven Eden <yamakuzure@gmx.net>
Tue, 14 Mar 2017 09:19:06 +0000 (10:19 +0100)
... instead of an array of n individual bytes.

Silences a lot of warnings in smatch.

src/basic/util.h

index 1245b39f744fce4e001907018f1a71f454f34edc..d7744a7d47d7f26256df4187320d77ea75de42a9 100644 (file)
@@ -83,7 +83,7 @@ int strcmp_ptr(const char *a, const char *b) _pure_;
 
 #define newdup(t, p, n) ((t*) memdup_multiply(p, sizeof(t), (n)))
 
-#define malloc0(n) (calloc((n), 1))
+#define malloc0(n) (calloc(1, (n)))
 
 static inline void *mfree(void *memory) {
         free(memory);