From Jakub Zawadzki:
authoretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 28 Apr 2010 08:15:20 +0000 (08:15 +0000)
committeretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 28 Apr 2010 08:15:20 +0000 (08:15 +0000)
 - use Glibc:s  highly optimized memchr()

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@32584 f5534014-38df-0310-8fa8-9805f1628bb7

epan/tvbuff.c

index 65100f27b32de7d1ce652754aff531af9ec563bd..5203ed67568bd64c3ae39b250a99345c13c80953 100644 (file)
@@ -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;
                }