pike.git/
src/
stralloc.c
Branch:
Tag:
Non-build tags
All tags
No tags
2011-07-22
2011-07-22 12:12:00 by Henrik Grubbström (Grubba) <grubba@grubba.org>
93863215f26ee05b217210f8049963dc683ff350 (
17
lines) (+
17
/-
0
)
[
Show
|
Annotate
]
Branch:
7.9
Atomic: Store the type in the ref_type field for all reference types.
532:
/* 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 */
603:
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;
724:
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;