]> git.ipfire.org Git - thirdparty/glibc.git/commit
manual: Fix missing include in memopen example.
authorCollin Funk <collin.funk1@gmail.com>
Sun, 28 Sep 2025 22:07:59 +0000 (15:07 -0700)
committerCollin Funk <collin.funk1@gmail.com>
Tue, 30 Sep 2025 00:01:54 +0000 (17:01 -0700)
commit85a31b7764ceb6a04d1e5677dfe33c45b82d82da
treeb085ef710a9d68bd4698cd891e952f674b73e0f2
parenta2a773992df172cf68d991224edfdc677abc69ad
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>
manual/examples/memopen.c