Fix: include stdlib.h in compat/string.h
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 15 Jan 2020 20:42:31 +0000 (15:42 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 5 Feb 2020 20:57:08 +0000 (15:57 -0500)
Fixes:

  CC       uuid.lo
In file included from /home/smarchi/src/lttng-tools/src/common/uuid.c:19:0:
/home/smarchi/src/lttng-tools/src/common/compat/string.h: In function ‘lttng_strndup’:
/home/smarchi/src/lttng-tools/src/common/compat/string.h:78:8: error: implicit declaration of function ‘malloc’ [-Werror=implicit-function-declaration]
  ret = malloc(navail);
        ^~~~~~
/home/smarchi/src/lttng-tools/src/common/compat/string.h:78:8: error: incompatible implicit declaration of built-in function ‘malloc’ [-Werror]
/home/smarchi/src/lttng-tools/src/common/compat/string.h:78:8: note: include ‘<stdlib.h>’ or provide a declaration of ‘malloc’

Note that this is in fallback code when the system doesn't provide
strndup (or, in my case, the system provides it but configure failed to
find it).

Change-Id: I5817b0b2436573b7d8fecb2956577a7b183d6296
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/compat/string.h

index a7bcab0a8c345a6e34019b2419d424207372be10..196d7d20d4dbe7501f7cfd7efb305baf6fe490f8 100644 (file)
@@ -25,6 +25,7 @@
 #define _COMPAT_STRING_H
 
 #include <string.h>
+#include <stdlib.h>
 
 #ifdef HAVE_STRNLEN
 static inline
This page took 0.025372 seconds and 4 git commands to generate.