WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [XEN] Avoid use of GNU-specific memmem().

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XEN] Avoid use of GNU-specific memmem().
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 04 Jan 2007 06:10:06 -0800
Delivery-date: Thu, 04 Jan 2007 06:10:03 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [XEN] Avoid use of GNU-specific memmem()., Xen patchbot-unstable <=