| iMatix home page
| << | < | > | >>
Version 2.11



#include "sflfind.h"
void *
memfind_r (const void  *block,          /*  Block containing data            */
           size_t       block_size,     /*  Size of block in bytes           */
           const void  *pattern,        /*  Pattern to search for            */
           size_t       pattern_size)   /*  Size of pattern block            */


Searches for a pattern in a block of memory using the Boyer- Moore-Horspool-Sunday algorithm. The block and pattern may contain any values; you must explicitly provide their lengths. Returns a pointer to the pattern if found within the block, or NULL if the pattern was not found. This function is meant to handle binary data, for a single search for a given pattern. If you need to search strings, use the strfind r() or strfind rb() functions. If you want to do efficient repeated searches for one pattern, use memfind rb(). Reentrant.

Source Code - (sflfind.c)

        searchbuf [256];                /*  One-time search buffer           */
        secondtime  = FALSE;

    ASSERT (block);                     /*  Expect non-NULL pointers, but    */
    ASSERT (pattern);                   /*  full through if not debugging    */

    return memfind rb (block, block_size, pattern, pattern_size,
                       searchbuf, &secondtime);

| << | < | > | >> iMatix Copyright © 1996-2000 iMatix Corporation