Fix build error with memmem()
PATCH 1/1 Fix build error with memmem()
Hi!
I get this build error on *BSD with changeset 13214:
symbols.c: In function `compress_symbols':
symbols.c:366: warning: implicit declaration of function `memmem' symbols.c:366: warning: assignment makes pointer from integer without a cast symbols.c:385: warning: assignment makes pointer from integer without a cast gmake[3]: *** [symbols] Error 1
gmake[3]: Leaving directory `/usr/src/xen-unstable.hg/xen/tools' gmake[2]: *** [default] Error 2
gmake[2]: Leaving directory /usr/src/xen-unstable.hg/xen/tools' gmake[1]: *** [/usr/src/xen-unstable-master.hg/xen/xen] Error 2 gmake[1]: Leaving directory /usr/src/xen-unstable.hg/xen'
The glibc manpage on Linux clearly says:
CONFORMING TO
This function is a GNU extension.
And according to the BUGS section, this function does not work reliably.
The attached patch makes this build again by replacing memmem() with strstr().
xen/tools/symbols.c +2 -2
@@ -363,7 +363,7 @@ static void compress_symbols(unsigned ch p1 = table[i].sym;/* find the token on the symbol */ - p2 =memmem (p1, len, str,2 ); + p2 =strstr (p1, str);if (!p2)continue ;/* decrease the counts for this symbol's tokens */
@@ -382,7 +382,7 @@ static void compress_symbols(unsigned chif (size <2 )break ;/* find the token on the symbol */ - p2 =memmem (p1, size, str,2 ); + p2 =strstr (p1, str); }while (p2);
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel