pike.git / src / stralloc.c

version» Context lines:

pike.git/src/stralloc.c:169: Inside #if defined(PIKE_DEBUG)
   pos, s->len-1);    } else {    Pike_fatal("Attempt to index the empty string with %"PRINTPTRDIFFT"d.\n",    pos);    }    }   #endif    return generic_extract(s->str,s->size_shift,pos);   }    - PMOD_EXPORT void low_set_index(struct pike_string *s, ptrdiff_t pos, -  int value) + void low_set_index(struct pike_string *s, ptrdiff_t pos, int value)   {   #ifdef PIKE_DEBUG    if(pos > s->len || pos<0) {    if (s->len) {    Pike_fatal("String index %"PRINTPTRDIFFT"d is out of "    "range 0..%"PRINTPTRDIFFT"d.\n",    pos, s->len-1);    } else {    Pike_fatal("Attempt to index the empty string with %"PRINTPTRDIFFT"d.\n",    pos);
pike.git/src/stralloc.c:414: Inside #if undefined(HASH_PREFIX) and #if 0
   prefix_depth, num_strings, need_more_hash_prefix_depth,    HASH_PREFIX);   #endif /* 0 */    need_more_hash_prefix_depth = prefix_depth;    }   #endif /* !HASH_PREFIX */    UNLOCK_BUCKET(hval);    return 0; /* not found */   }    - PMOD_EXPORT struct pike_string *binary_findstring(const char *foo, ptrdiff_t l) + struct pike_string *binary_findstring(const char *foo, ptrdiff_t l)   {    return internal_findstring(foo, l, 0, StrHash(foo,l));   }    - PMOD_EXPORT struct pike_string *findstring(const char *foo) + struct pike_string *findstring(const char *foo)   {    return binary_findstring(foo, strlen(foo));   }      /*    * find a string that is already shared and move it to the head    * of that list in the hastable    */   static struct pike_string *propagate_shared_string(const struct pike_string *s,    ptrdiff_t h)
pike.git/src/stralloc.c:657:    num_strings++;    UNLOCK_BUCKET(hval);       if(num_strings > MAX_AVG_LINK_LENGTH * htable_size) {    stralloc_rehash();    }      #ifndef HASH_PREFIX    /* These heuristics might require tuning! /Hubbe */    if((need_more_hash_prefix_depth > MAX_AVG_LINK_LENGTH * 4) || -  (need_new_hashkey_depth > MAX_AVG_LINK_LENGTH * 16)) +  (need_new_hashkey_depth > MAX_AVG_LINK_LENGTH * 128))    {    /* Changed heuristic 2005-01-17:    *    * Increase HASH_PREFIX if there's some bucket containing    * more than MAX_AVG_LINK_LENGTH * 4 strings that are longer    * than HASH_PREFIX.    * /grubba    *    * Changed heuristic 2011-12-30:    *
pike.git/src/stralloc.c:1435: Inside #if defined(PIKE_DEBUG)
   UNLOCK_BUCKET(e);    }   }      #endif         /*** String compare functions ***/      /* does not take locale into account */ - PMOD_EXPORT int low_quick_binary_strcmp(char *a, ptrdiff_t alen, + int low_quick_binary_strcmp(char *a, ptrdiff_t alen,    char *b, ptrdiff_t blen)   {    int tmp;    if(alen > blen)    {    tmp=MEMCMP(a, b, blen);    if(tmp) return tmp;    return 1;    }else if(alen < blen){    tmp=MEMCMP(a, b, alen);
pike.git/src/stralloc.c:1623: Inside #if defined(HAVE_STRCOLL)
   return tmp;    }else   #endif    if(ac-bc) return ac-bc;    }    return a->len - b->len;    }    }   }    - PMOD_EXPORT struct pike_string *realloc_unlinked_string(struct pike_string *a, + struct pike_string *realloc_unlinked_string(struct pike_string *a,    ptrdiff_t size)   {    struct pike_string *r = NULL;       if (a->len <= SHORT_STRING_THRESHOLD) {    if (size <= SHORT_STRING_THRESHOLD) {    /* There's already space enough. */    a->len = size;    low_set_index(a, size, 0);    return a;