# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1167905854 0
# Node ID bdbfbfdfbd64ddedc775d55f1a9e842847fea7b2
# Parent 60f91c9f1a248491e2f216d009a27a4c7e5e67d4
[XEN] Avoid use of GNU-specific memmem().
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
xen/tools/symbols.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff -r 60f91c9f1a24 -r bdbfbfdfbd64 xen/tools/symbols.c
--- a/xen/tools/symbols.c Wed Jan 03 23:53:27 2007 +0000
+++ b/xen/tools/symbols.c Thu Jan 04 10:17:34 2007 +0000
@@ -350,6 +350,14 @@ static void build_initial_tok_table(void
table_cnt = pos;
}
+static void *memmem_pvt(void *h, size_t hlen, void *n, size_t nlen)
+{
+ char *p;
+ for (p = h; (p - (char *)h) <= (hlen - nlen); p++)
+ if (!memcmp(p, n, nlen)) return p;
+ return NULL;
+}
+
/* replace a given token in all the valid symbols. Use the sampled symbols
* to update the counts */
static void compress_symbols(unsigned char *str, int idx)
@@ -363,7 +371,7 @@ static void compress_symbols(unsigned ch
p1 = table[i].sym;
/* find the token on the symbol */
- p2 = memmem(p1, len, str, 2);
+ p2 = memmem_pvt(p1, len, str, 2);
if (!p2) continue;
/* decrease the counts for this symbol's tokens */
@@ -382,7 +390,7 @@ static void compress_symbols(unsigned ch
if (size < 2) break;
/* find the token on the symbol */
- p2 = memmem(p1, size, str, 2);
+ p2 = memmem_pvt(p1, size, str, 2);
} while (p2);
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|