Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame^] | 1 | From 22fba4f2765f92cd592a58e1fe5c450b187e30e1 Mon Sep 17 00:00:00 2001 |
| 2 | From: Andre McCurdy <armccurdy@gmail.com> |
| 3 | Date: Wed, 3 Jun 2015 21:39:03 -0700 |
| 4 | Subject: [PATCH] avoid redefining strnlen() and strndup() |
| 5 | |
| 6 | Rely on string.h definitions instead. Workaround for compiler errors such as: |
| 7 | |
| 8 | | i686-rdk-linux-libtool: compile: i686-rdk-linux-gcc -m32 -march=atom -mtune=atom -fschedule-insns -fsched-pressure -msse3 -mfpmath=sse --sysroot=/home/andre/build/tmp/sysroots/7401 -DHAVE_CONFIG_H -I. -I/home/andre/build/tmp/work/core2-32-rdk-linux/libupnp/1.6.19-r0/libupnp-1.6.19/upnp -I.. -I../upnp/inc -I/home/andre/build/tmp/work/core2-32-rdk-linux/libupnp/1.6.19-r0/libupnp-1.6.19/upnp/inc -I/home/andre/build/tmp/work/core2-32-rdk-linux/libupnp/1.6.19-r0/libupnp-1.6.19/threadutil/inc -I/home/andre/build/tmp/work/core2-32-rdk-linux/libupnp/1.6.19-r0/libupnp-1.6.19/ixml/inc -I/home/andre/build/tmp/work/core2-32-rdk-linux/libupnp/1.6.19-r0/libupnp-1.6.19/upnp/src/inc -pthread -O2 -pipe -g -feliminate-unused-debug-types -Os -Wall -c /home/andre/build/tmp/work/core2-32-rdk-linux/libupnp/1.6.19-r0/libupnp-1.6.19/upnp/src/gena/gena_callback2.c -o src/gena/libupnp_la-gena_callback2.o >/dev/null 2>&1 |
| 9 | | In file included from /home/andre/build/tmp/sysroots/7401/usr/include/string.h:634:0, |
| 10 | | from /home/andre/build/tmp/work/core2-32-rdk-linux/libupnp/1.6.19-r0/libupnp-1.6.19/upnp/src/api/UpnpString.c:23: |
| 11 | | /home/andre/build/tmp/work/core2-32-rdk-linux/libupnp/1.6.19-r0/libupnp-1.6.19/upnp/src/api/UpnpString.c:47:15: error: expected identifier or '(' before '__extension__' |
| 12 | | extern char *strndup(__const char *__string, size_t __n); |
| 13 | | ^ |
| 14 | | make[3]: *** [src/api/libupnp_la-UpnpString.lo] Error 1 |
| 15 | |
| 16 | Upstream-Status: Pending |
| 17 | |
| 18 | Signed-off-by: Andre McCurdy <armccurdy@gmail.com> |
| 19 | --- |
| 20 | upnp/src/api/UpnpString.c | 4 ++-- |
| 21 | 1 file changed, 2 insertions(+), 2 deletions(-) |
| 22 | |
| 23 | diff --git a/upnp/src/api/UpnpString.c b/upnp/src/api/UpnpString.c |
| 24 | index 41c9898..2fa09d7 100644 |
| 25 | --- a/upnp/src/api/UpnpString.c |
| 26 | +++ b/upnp/src/api/UpnpString.c |
| 27 | @@ -32,7 +32,7 @@ |
| 28 | /* VC has strnlen which is already included but with (potentially) different linkage */ |
| 29 | /* strnlen() is a GNU extension. */ |
| 30 | #if HAVE_STRNLEN |
| 31 | - extern size_t strnlen(const char *s, size_t maxlen); |
| 32 | +// extern size_t strnlen(const char *s, size_t maxlen); |
| 33 | #else /* HAVE_STRNLEN */ |
| 34 | static size_t strnlen(const char *s, size_t n) |
| 35 | { |
| 36 | @@ -44,7 +44,7 @@ |
| 37 | |
| 38 | /* strndup() is a GNU extension. */ |
| 39 | #if HAVE_STRNDUP && !defined(WIN32) |
| 40 | - extern char *strndup(__const char *__string, size_t __n); |
| 41 | +// extern char *strndup(__const char *__string, size_t __n); |
| 42 | #else /* HAVE_STRNDUP && !defined(WIN32) */ |
| 43 | static char *strndup(const char *__string, size_t __n) |
| 44 | { |
| 45 | -- |
| 46 | 1.9.1 |
| 47 | |