Re: string -> refcounted string -> buffer referencing

From: Adrian Chadd <adrian@dont-contact.us>
Date: Thu, 13 Dec 2007 01:48:06 +0900

On Sun, Dec 09, 2007, Adrian Chadd wrote:

> A pass through the Squid source to convert the 170-odd strBuf() references
> into something that doesn't treat strBuf() as being NUL-terminated:
>
> - using String's locally, instead of const char * foo = strBuf(); (do stuff with foo)
> - in the case of const char * foo = xstrdup(strBuf()); modify; safe_free(foo)
> (eg the ACL code) then create a new operator to do the allocation but using
> strLen() rather than expecting NUL-termination

I'm down to 69 of these. They're starting to get slightly harder.

I'd appreciate some reviews of my changes to make sure that my alterations
aren't changing semantics at all. In theory they shouldn't be - I'm mostly
either explicitly using the length (eg debug() calls) or moving the strlen(buf)
call from inside a worker function to outside, and then either manually calling
strlen() or passing in StrLen2().

http://devel.squid-cache.org/changesets/squid/s27_adri.html

I'm going to stop working on this the moment that I've converted the last one
and do as much testing as I can when its in Squid-2.HEAD (post the 2.7 branch.)
The next phase (actually not using NUL-terminated buffers) is a pretty big leap
and I'd like to be reasonably certain I've converted over code correctly.

Thanks!

Adrian
Received on Wed Dec 12 2007 - 09:41:39 MST

This archive was generated by hypermail pre-2.1.9 : Mon Dec 31 2007 - 12:00:03 MST