pike.git / src / cyclic.c

version» Context lines:

pike.git/src/cyclic.c:36:    * The multiplication has the effect of accumulating    * the segments of 10 bits of h in the most significant    * segment, which is then shifted down.    */    h *= 0x100401;    h >>= 20;       return h & (CYCLIC_HASH_SIZE-1);   }    - static void low_unlink_cyclic(CYCLIC *c) + void low_unlink_cyclic(CYCLIC *c)   {    size_t h;    CYCLIC **p;       h = cyclic_hash_func(c);       for(p=cyclic_hash+h;*p;p=&(p[0]->next))    {    if(c == *p)    {
pike.git/src/cyclic.c:67:    Pike_fatal("Unlink cyclic on lost cyclic struct.\n");   #endif   }      PMOD_EXPORT void unlink_cyclic(CYCLIC *c)   {    UNSET_ONERROR(c->onerr);    low_unlink_cyclic(c);   }    - PMOD_EXPORT void *begin_cyclic(CYCLIC *c, + void *low_begin_cyclic(CYCLIC *c,    char *id,    void *th,    void *a,    void *b)   {    size_t h;    void *ret = 0;    CYCLIC *p;       c->ret = (void *)(ptrdiff_t)1;
pike.git/src/cyclic.c:99: Inside #if defined(CYCLIC_DEBUG)
  #ifdef CYCLIC_DEBUG    fprintf (stderr, "%s: BEGIN_CYCLIC a=%p b=%p: found cycle\n", id, a, b);   #endif    c->ret = ret = p->ret;    break;    }    }       c->next = cyclic_hash[h];    cyclic_hash[h] = c; -  SET_ONERROR(c->onerr, low_unlink_cyclic, c); +    #ifdef CYCLIC_DEBUG    if (!ret) fprintf (stderr, "%s: BEGIN_CYCLIC a=%p b=%p: no cycle\n", id, a, b);   #endif    return ret;   } -  +  + PMOD_EXPORT void *begin_cyclic(CYCLIC *c, +  char *id, +  void *th, +  void *a, +  void *b) + { +  void *ret = low_begin_cyclic(c, id, th, a, b); +  SET_ONERROR(c->onerr, low_unlink_cyclic, c); +  return ret; + }