Space one byte per string

db4
Slava Pestov 2008-02-04 14:05:31 -06:00
parent 0311c0a842
commit bc2ce8a77b
3 changed files with 2 additions and 6 deletions

View File

@ -248,7 +248,7 @@ M: wrapper '
emit-seq ; emit-seq ;
: pack-string ( string -- newstr ) : pack-string ( string -- newstr )
dup length 1+ bootstrap-cell align 0 pad-right ; dup length bootstrap-cell align 0 pad-right ;
: emit-string ( string -- ptr ) : emit-string ( string -- ptr )
string type-number object tag-number [ string type-number object tag-number [

View File

@ -463,10 +463,6 @@ F_STRING* allot_string_internal(CELL capacity)
{ {
F_STRING *string = allot_object(STRING_TYPE,string_size(capacity)); F_STRING *string = allot_object(STRING_TYPE,string_size(capacity));
/* strings are null-terminated in memory, even though they also
have a length field. The null termination allows us to add
the sizeof(F_STRING) to a Factor string to get a C-style
char* string for C library calls. */
string->length = tag_fixnum(capacity); string->length = tag_fixnum(capacity);
string->hashcode = F; string->hashcode = F;
string->aux = F; string->aux = F;

View File

@ -11,7 +11,7 @@ INLINE CELL string_capacity(F_STRING* str)
INLINE CELL string_size(CELL size) INLINE CELL string_size(CELL size)
{ {
return sizeof(F_STRING) + size + 1; return sizeof(F_STRING) + size;
} }
DEFINE_UNTAG(F_BYTE_ARRAY,BYTE_ARRAY_TYPE,byte_array) DEFINE_UNTAG(F_BYTE_ARRAY,BYTE_ARRAY_TYPE,byte_array)