Leopold Toetsch <[EMAIL PROTECTED]> writes:

> The issues WRT the union initializer are gone now (can people please
> test, if the program below compiles cleanly now) - but:
> 
> 
> - make_COW_* sets flag on the source string [1]
> - if that is solved (with a special RO flag, or whatever) we have:
> - string_make sets a default type and encoding if these arguments were
> NULL. These constant strings have NULL for encoding/type so during
> string_append as the encodings differ transcode is called - next
> SIGSEGV with NULL encoding pointer.

It is in principle possible to use a &default_encoding in the static
initialiser, but then a relocation is needed because the static string
and &default_encoding are not in the same object-file. This would lead
to a longer load-time. 

On the other hand accessing the encoding through macros
#define ENCODING_skip_forward(enc, p, n) ((enc) ? \
  (enc)->skip_forward(p, n) : \
  default_enc->skip_forward(p, n))
has a runtime cost; the test will fool the branch prediction.

> So using these .rodata-constant STRINGs needs a lot of work.
> - COW code (there are problems with COWed stacks anyway)
> - transcoding stuff (should be changed to use {strstart, byteidx} and
> do something about default vs NULL type/encoding.

Next idea:
create a new function
STRING *string_from_static_cstring(const char *cstr);
which does not copy the string to newly allocated memory. But maybe
then the problems with COW are still there.

[...]
bye
boe
-- 
Juergen Boemmels                        [EMAIL PROTECTED]
Fachbereich Physik                      Tel: ++49-(0)631-205-2817
Universitaet Kaiserslautern             Fax: ++49-(0)631-205-3906
PGP Key fingerprint = 9F 56 54 3D 45 C1 32 6F  23 F6 C7 2F 85 93 DD 47

Reply via email to