From 1c1142fce65e8739d925b7de590ba1d6d12972ce Mon Sep 17 00:00:00 2001 From: Anders Broman Date: Wed, 28 Apr 2010 08:15:20 +0000 Subject: [PATCH] From Jakub Zawadzki: - use Glibc:s highly optimized memchr() svn path=/trunk/; revision=32584 --- epan/tvbuff.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/epan/tvbuff.c b/epan/tvbuff.c index 65100f27b3..5203ed6756 100644 --- a/epan/tvbuff.c +++ b/epan/tvbuff.c @@ -954,21 +954,6 @@ fast_ensure_contiguous(tvbuff_t *tvb, const gint offset, const guint length) return NULL; } -static const guint8* -guint8_find(const guint8* haystack, const size_t haystacklen, const guint8 needle) -{ - const guint8 *b; - int i; - - for (b = haystack, i = 0; (guint) i < haystacklen; i++, b++) { - if (*b == needle) { - return b; - } - } - - return NULL; -} - static const guint8* guint8_pbrk(const guint8* haystack, size_t haystacklen, const guint8 *needles, guchar *found_needle) { @@ -1822,7 +1807,7 @@ tvb_find_guint8(tvbuff_t *tvb, const gint offset, const gint maxlength, const gu /* If we have real data, perform our search now. */ if (tvb->real_data) { - result = guint8_find(tvb->real_data + abs_offset, limit, needle); + result = memchr(tvb->real_data + abs_offset, needle, limit); if (result == NULL) { return -1; }