On Thu, 10 Jan 2002, Simon Glover wrote:
>
>  This fixes a couple of nits in rx.c:

patch seems fine, but got me thinking...

>    2. We should use NULL, not 0 or "", for creating null pointers.

"" isn't a NULL pointer although at present there isn't any difference
in the result of

string_make(INTERP, "" ...) and string_make(INTERP, NULL, ...)

I think this makes sense, but could do with being documented,
also will the various string_* functions that take interpreters as
args continue to do so, as if so I'll update the string docs.

Also, I'm a bit concerned that our null termination games:

    s->bufstart = mem_sys_allocate(buflen+1);
    ...
    memset((char *)s->bufstart+s->bufused,0,1);

Are going to lead to an eternity of OBO errors.  Also if our encoding or
output does not require termination, this is a waste of time.  Also
I don't think all the string functions update the termination when
they add characters beyond bufused but below buflen, which means that
any output function that needs null termination will have to check
for this itself anyway.  All in all, I think it would make more sense to
keep the code that cares about termination away from the general string
code as it's being a bit obscuring at present.

Alex Gough

Reply via email to