pike.git / src / pike_search_engine2.c

version» Context lines:

pike.git/src/pike_search_engine2.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id$ +    */      /*    * NCHAR = Needle character    * HCHAR = Haystack character    */      static INLINE HCHAR *NameNH(MEMCHR)(HCHAR *p, NCHAR c, ptrdiff_t e)   {   #if NSHIFT > HSHIFT    if(c > (1<<(8*HSHIFT))) return 0;   #endif    return NameH(MEMCHR)(p,c,e);   }         static INLINE int NameNH(MEMCMP)(NCHAR *a, HCHAR *b, ptrdiff_t e)   {   #if NSHIFT == HSHIFT -  return MEMCMP(a, b, sizeof(HCHAR)*e); +  return memcmp(a, b, sizeof(HCHAR)*e);   #else    for(;e;e--,b++,a++)    {    if(*b!=*a)    {    if(*b<*a) return -1;    if(*b>*a) return 1;    }    }    return 0;      #endif   }      HCHAR *NameNH(memchr_search)(void *data,    HCHAR *haystack,    ptrdiff_t haystacklen)   {    return NameNH(MEMCHR)(haystack, -  DO_NOT_WARN((NCHAR)(ptrdiff_t) PTR_TO_INT(data)), +  (NCHAR)(ptrdiff_t) PTR_TO_INT(data),    haystacklen);   }       -  + #ifndef DEBUG_CLANG + static /* works around clang 3.0 compilation/linking error. */ + #endif   INLINE HCHAR *NameNH(memchr_memcmp)(NCHAR *needle,    ptrdiff_t needlelen,    HCHAR *haystack,    ptrdiff_t haystacklen)   {    NCHAR c;    HCHAR *end;       if(needlelen > haystacklen) return 0;   
pike.git/src/pike_search_engine2.c:158:    HCHAR *haystack,    ptrdiff_t haystacklen)   {    NCHAR *needle = NEEDLE;    ptrdiff_t nlen = NEEDLELEN;    size_t hsize = s->hsize;    size_t max = s->max;       INT32 tmp, h;    HCHAR *q, *end; -  register struct hubbe_search_link *ptr; +  struct hubbe_search_link *ptr;       end=haystack+haystacklen;    q=haystack + max - 4;       NameH(HUBBE_ALIGN)(q);    -  for(;q<=end-sizeof(INT32);q+=max) +  for(;q<=(HCHAR*)(((char *)end)-sizeof(INT32));q+=max)    {    h=tmp=NameH(GET_4_ALIGNED_CHARS)(q);       h+=h>>7;    h+=h>>17;    h&=hsize;       for(ptr=s->set[h];ptr;ptr=ptr->next)    {    HCHAR *where;