pike.git / src / stralloc.c

version» Context lines:

pike.git/src/stralloc.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: stralloc.c,v 1.161 2004/03/07 23:25:45 nilsson Exp $ + || $Id: stralloc.c,v 1.162 2004/03/19 16:02:03 grubba Exp $   */      #include "global.h"   #include "stralloc.h"   #include "pike_macros.h"   #include "dynamic_buffer.h"   #include "pike_macros.h"   #include "pike_memory.h"   #include "pike_error.h"   #include "gc.h"
pike.git/src/stralloc.c:17:   #include "bignum.h"   #include "interpret.h"   #include "block_alloc.h"   #include "operators.h"      #include <errno.h>   #include <float.h>   #include <ctype.h>   #include <math.h>    - RCSID("$Id: stralloc.c,v 1.161 2004/03/07 23:25:45 nilsson Exp $"); + RCSID("$Id: stralloc.c,v 1.162 2004/03/19 16:02:03 grubba Exp $");      /* #define STRALLOC_USE_PRIMES */      #ifdef STRALLOC_USE_PRIMES      #define SET_HSIZE(X) htable_size=hashprimes[(X)]   #define HMODULO(X) ((X) % htable_size)      #else   
pike.git/src/stralloc.c:154:    switch(size)    {    case 0: return ((unsigned char *)str)[pos];    case 1: return ((unsigned INT16 *)str)[pos];    case 2: return ((unsigned INT32 *)str)[pos];    }    Pike_fatal("Illegal shift size!\n");    return 0;   }    - PMOD_EXPORT INLINE unsigned INT32 index_shared_string(struct pike_string *s, + PMOD_EXPORT unsigned INT32 index_shared_string(struct pike_string *s,    ptrdiff_t pos)   {   #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);    }    }   #endif    return generic_extract(s->str,s->size_shift,pos);   }    - PMOD_EXPORT INLINE void low_set_index(struct pike_string *s, ptrdiff_t pos, + PMOD_EXPORT 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",
pike.git/src/stralloc.c:201:    {    case 0: STR0(s)[pos]=value; break;    case 1: STR1(s)[pos]=value; break;    case 2: STR2(s)[pos]=value; break;    default:    Pike_fatal("Illegal shift size!\n");    }   }      #ifdef PIKE_DEBUG - PMOD_EXPORT INLINE struct pike_string *debug_check_size_shift(struct pike_string *a,int shift) + PMOD_EXPORT struct pike_string *debug_check_size_shift(struct pike_string *a, +  int shift)   {    if(a->size_shift != shift)    Pike_fatal("Wrong STRX macro used!\n");    return a;   }   #endif      #define CONVERT(FROM,TO) \   INLINE void PIKE_CONCAT4(convert_,FROM,_to_,TO)(PIKE_CONCAT(p_wchar,TO) *to, const PIKE_CONCAT(p_wchar,FROM) *from, ptrdiff_t len) \   { while(--len>=0) *(to++)=*(from++); } \