All --

I've got some diffs in my sandbox that I thought I had submitted
at one point, but I can't find any evidence of them being submitted,
so I'll open discussion here.

The first change is that the prototype for string_to_cstring()
becomes:

  char *
  string_to_cstring(struct Parrot_Interp * interpreter, STRING * s,
INTVAL * len)

The reason is that the caller *should* care about the length, since
there is no guarantee that we didn't return a buffer that contained
interior zero bytes (which would make calling strlen() on it return
the wrong answer).

There are of course a bunch of places this is used, so changes to
all those places would be required.


The next change is a change to the IO layer. In include/parrot/io.h
we change struct _ParrotIOLayerAPI to have two versions of C string
writing:

    INTVAL (*PutSc)(theINTERP, ParrotIOLayer * l, /* C-style string put
*/
                            ParrotIO * io, const char * s);
    INTVAL (*PutSl)(theINTERP, ParrotIOLayer * l, /* Explicit length
string put */
                            ParrotIO * io, const char * s, INTVAL len);

and chase down and fix all the things this breaks. The reason is we
might need to output a buffer of stuff that contains an interior zero
byte, which would throw off the old way of doing things.


Regards,

--Gregor

-- 
Gregor Purdy                            [EMAIL PROTECTED]
Focus Research, Inc.               http://www.focusresearch.com/

Reply via email to