mirror of git://sourceware.org/git/glibc.git
manual: Fix missing include in memopen example.
Previously this file would fail to compile with the following error:
$ gcc manual/examples/memopen.c
manual/examples/memopen.c: In function ‘main’:
manual/examples/memopen.c:28:30: error: implicit declaration of function ‘strlen’ [-Wimplicit-function-declaration]
28 | stream = fmemopen (buffer, strlen (buffer), "r");
| ^~~~~~
manual/examples/memopen.c:19:1: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
18 | #include <stdio.h>
+++ |+#include <string.h>
19 |
manual/examples/memopen.c:28:30: warning: incompatible implicit declaration of built-in function ‘strlen’ [-Wbuiltin-declaration-mismatch]
28 | stream = fmemopen (buffer, strlen (buffer), "r");
| ^~~~~~
manual/examples/memopen.c:28:30: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
parent
a2a773992d
commit
85a31b7764
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
static char buffer[] = "foobar";
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue