pike.git / src / stralloc.c

version» Context lines:

pike.git/src/stralloc.c:525:   /* Without the str at the end, to get the size of the header. */   struct pike_string_hdr {    PIKE_STRING_CONTENTS;   };      /* Allocate some fixed string sizes with BLOCK_ALLOC. */      /* Use the BLOCK_ALLOC() stuff for short strings */      #undef INIT_BLOCK + #ifdef ATOMIC_SVALUE   #define INIT_BLOCK(NEW_STR) do { \ -  +  (NEW_STR)->ref_type = T_STRING; \    (NEW_STR)->refs = 0; \    add_ref((NEW_STR)); \    (NEW_STR)->flags = \    STRING_NOT_HASHED|STRING_NOT_SHARED|STRING_IS_SHORT; \    } while(0) -  + #else /* !ATOMIC_SVALUE */ + #define INIT_BLOCK(NEW_STR) do { \ +  (NEW_STR)->refs = 0; \ +  add_ref((NEW_STR)); \ +  (NEW_STR)->flags = \ +  STRING_NOT_HASHED|STRING_NOT_SHARED|STRING_IS_SHORT; \ +  } while(0) + #endif      #define SHORT_STRING_BLOCK 256   #define SHORT_STRING_THRESHOLD 15 /* % 4 === -1 */      struct short_pike_string0 {    PIKE_STRING_CONTENTS;    p_wchar0 str[SHORT_STRING_THRESHOLD+1];   };      struct short_pike_string1 {
pike.git/src/stralloc.c:596: Inside #if defined(PIKE_DEBUG)
   extern int d_flag;    if(d_flag>10)    verify_shared_strings_tables();   #endif    if (len <= SHORT_STRING_THRESHOLD) {    t=(struct pike_string *)alloc_short_pike_string0();    } else {    t=(struct pike_string *)xalloc(len + 1 + sizeof(struct pike_string_hdr));    t->flags = STRING_NOT_HASHED | STRING_NOT_SHARED;    } + #ifdef ATOMIC_SVALUE +  t->ref_type = T_STRING; + #endif    t->refs = 0;    add_ref(t); /* For DMALLOC */    t->str[len]=0;    t->len=len;    t->size_shift=0;    DO_IF_DEBUG(t->next = NULL);    return t;   }      static void link_pike_string(struct pike_string *s, size_t hval)
pike.git/src/stralloc.c:717:    Pike_fatal("Unsupported string shift: %d\n", shift);   #endif /* PIKE_DEBUG */    } else {    t = (struct pike_string *)alloc_short_pike_string2();    }    } else {    t=(struct pike_string *)xalloc(((len + 1)<<shift) +    sizeof(struct pike_string_hdr));    t->flags = STRING_NOT_HASHED|STRING_NOT_SHARED;    } + #ifdef ATOMIC_SVALUE +  t->ref_type = T_STRING; + #endif    t->refs = 0;    add_ref(t); /* For DMALLOC */    t->len=len;    t->size_shift=shift;    DO_IF_DEBUG(t->next = NULL);    low_set_index(t,len,0);    return t;   }      PMOD_EXPORT void hash_string(struct pike_string *s)