Branch: Tag:


2014-11-12 10:28:31 by Per Hedbor <>

Fundamental properties of empty strings corrected.

An empty string:
- IS lowercase
- IS uppercase

'STRING_IS_LOWERCASE' means the same string will be returned for
lower_case(str), and 'STRING_IS_UPPERCASE' means the same string will
be returned for upper_case(str).

Having this be wrong for the empty string is not really a good idea,
since when strings are constructed using += the bits will not be set
correctly if you start with the empty string.

Also note: All code using string ranges really needs a special case
for the empty string, since its range of characters, when checked
using check_string_range, will be 0..255 (loose check), or
-MAX_INT32..MAX_INT32 (non-loose check).

This is done correctly in the 'string_has_null' function, which is
what is supposed to be used to check if strings contain null

2137:    base_table=xcalloc(sizeof(struct pike_string *), htable_size);       empty_pike_string = make_shared_string(""); +  empty_pike_string->flags |= STRING_IS_LOWERCASE | STRING_IS_UPPERCASE;   }      #ifdef DO_PIKE_CLEANUP