pike.git / src / stralloc.c

version» Context lines:

pike.git/src/stralloc.c:20:      #include <errno.h>   #include <float.h>   #include <ctype.h>   #include <math.h>      #ifndef HUGE   #define HUGE HUGE_VAL   #endif /*!HUGE*/    - RCSID("$Id: stralloc.c,v 1.131 2001/08/29 11:51:59 grubba Exp $"); + RCSID("$Id: stralloc.c,v 1.132 2001/09/04 19:26:54 mast Exp $");      #if PIKE_RUN_UNLOCKED   /* Make this bigger when we get lightweight threads */   #define BUCKET_LOCKS 2048   static PIKE_MUTEX_T *bucket_locks;      #define BUCKETLOCK(HVAL) \    (bucket_locks + ((hval__ % htable_size) & (BUCKET_LOCKS-1)))      #define LOCK_BUCKET(HVAL) do { \
pike.git/src/stralloc.c:1877:   {    unsigned INT32 e;    if(!base_table) return;    for(e=0;e<htable_size;e++)    {    struct pike_string *p;    for(p=base_table[e];p;p=p->next) gc_is_referenced(p);    }   }    + struct pike_string *next_pike_string (struct pike_string *s) + { +  struct pike_string *next = s->next; +  if (!next) { +  size_t h = s->hval; +  do { +  h++; +  LOCK_BUCKET(h); +  h %= htable_size; +  next = base_table[h]; +  UNLOCK_BUCKET(h); +  } while (!next); +  } +  return next; + } +    PMOD_EXPORT void init_string_builder(struct string_builder *s, int mag)   {    s->malloced=256;    s->s=begin_wide_shared_string(256,mag);    s->s->len=0;    s->s->str[0] = 0;    s->known_shift=0;   }      PMOD_EXPORT void init_string_builder_alloc(struct string_builder *s, ptrdiff_t length, int mag)