pike.git / src / pike_search_engine.c

version» Context lines:

pike.git/src/pike_search_engine.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: pike_search_engine.c,v 1.13 2006/07/05 19:15:35 mast Exp $ + || $Id: pike_search_engine.c,v 1.14 2008/06/23 16:02:25 mast Exp $   */      /*    * Written by Fredrik Hubinette (hubbe@lysator.liu.se)    */      #define HSHIFT 0   #include "pike_search_engine2.c"   #undef HSHIFT   
pike.git/src/pike_search_engine.c:40:    } \    Pike_fatal("Illegal shift\n"); \    return haystack; /* NOT_REACHED */ \   } \    \   static const struct SearchMojtVtable PxC3(NAME,NSHIFT,_vtable) = { \    (SearchMojtFunc0)PxC3(NAME,NSHIFT,0), \    (SearchMojtFunc1)PxC3(NAME,NSHIFT,1), \    (SearchMojtFunc2)PxC3(NAME,NSHIFT,2), \    (SearchMojtFuncN)PxC3(NAME,NSHIFT,N), \ -  PxC2(NAME,_free), \ +    };         INTERMEDIATE(memchr_search)   INTERMEDIATE(memchr_memcmp2)   INTERMEDIATE(memchr_memcmp3)   INTERMEDIATE(memchr_memcmp4)   INTERMEDIATE(memchr_memcmp5)   INTERMEDIATE(memchr_memcmp6)   INTERMEDIATE(boyer_moore_hubbe)
pike.git/src/pike_search_engine.c:282:    * if NSHIFT > 0 but all characters in needle can fit in    * a narrower string, it might pay off to reduce the width    * of the string.    */    if(len<7)    {    struct pike_mem_searcher tmp;    NameN(init_memsearch)(&tmp,    needle,len,    max_haystacklen); +  tmp.mojt.container = NULL;    return tmp.mojt;    }else{    struct svalue *sval,stmp;    struct pike_mem_searcher *s;    struct object *o;       if(!hashkey)    hashkey=NameN(make_shared_binary_string)(needle,len);    else    add_ref(hashkey);       if((sval=low_mapping_string_lookup(memsearch_cache,hashkey)))    {    if(sval->type == T_OBJECT)    {    o=sval->u.object;    if(o->prog == pike_search_program)    {    s=OB2MSEARCH(sval->u.object); -  +  assert (sval->u.object == s->mojt.container);    add_ref(sval->u.object);    free_string(hashkey);    return s->mojt;    }    }    }       o=low_clone(pike_search_program);    s=OB2MSEARCH(o); -  s->data.hubbe.o=o; +  s->mojt.container = o; /* Not refcounted self-ref. */    s->s=hashkey;       /* We use 0x7fffffff for max_haystacklen because we do    * not know how many times this search struct will be    * reused.    */    NameN(init_memsearch)(s,    needle,len,    0x7fffffff);    stmp.type = T_OBJECT;    stmp.subtype = 0;    stmp.u.object = o;       mapping_string_insert(memsearch_cache, hashkey, &stmp);       return s->mojt;    }   }