diff options
author | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2007-01-04 10:17:34 +0000 |
---|---|---|
committer | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2007-01-04 10:17:34 +0000 |
commit | 5719e608b404c5f566ab2410047ba07ebe02d588 (patch) | |
tree | 41dd9f7f1b9ce5b91991882d7f9d241a4f8bac5a /xen/tools | |
parent | 72c07f413879d47a5bd472ff8971a0c5bb4b205d (diff) | |
download | xen-5719e608b404c5f566ab2410047ba07ebe02d588.tar.gz xen-5719e608b404c5f566ab2410047ba07ebe02d588.tar.bz2 xen-5719e608b404c5f566ab2410047ba07ebe02d588.zip |
[XEN] Avoid use of GNU-specific memmem().
Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'xen/tools')
-rw-r--r-- | xen/tools/symbols.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/xen/tools/symbols.c b/xen/tools/symbols.c index ed126a2d06..00f1a43037 100644 --- a/xen/tools/symbols.c +++ b/xen/tools/symbols.c @@ -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 char *str, int idx) 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 char *str, int idx) 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); |