pike.git / src / stralloc.c

version» Context lines:

pike.git/src/stralloc.c:8:   #include "pike_macros.h"   #include "dynamic_buffer.h"   #include "pike_macros.h"   #include "pike_memory.h"   #include "error.h"   #include "gc.h"   #include "stuff.h"      #include <ctype.h>    - RCSID("$Id: stralloc.c,v 1.45 1998/10/15 02:34:37 grubba Exp $"); + RCSID("$Id: stralloc.c,v 1.46 1998/10/15 02:38:49 grubba Exp $");      #define BEGIN_HASH_SIZE 997   #define MAX_AVG_LINK_LENGTH 3   #define HASH_PREFIX 64      unsigned INT32 htable_size=0;   static unsigned int hashprimes_entry=0;   static struct pike_string **base_table=0;   static unsigned INT32 full_hash_value;   unsigned INT32 num_strings=0;
pike.git/src/stralloc.c:84:    case 1: return ((unsigned INT16 *)str)[pos];    case 2: return ((unsigned INT32 *)str)[pos];    default:    fatal("Illegal shift size!\n");    }   }      INLINE unsigned INT32 index_shared_string(struct pike_string *s, int pos)   {   #ifdef DEBUG -  if(pos >= s->len || pos<0) { +  if(pos > s->len || pos<0) {    if (s->len) {    fatal("String index %d is out of range [0 - %d]!\n", pos, s->len-1);    } else {    fatal("Attempt to index the empty string with %d!\n", pos);    }    }   #endif    return generic_extract(s->str,s->size_shift,pos);   }