Re: [PATCH] String API re-implementation using SBuf

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Mon, 23 Dec 2013 16:07:13 +1300

On 20/11/2013 1:19 a.m., Amos Jeffries wrote:
> [ And here is the new patch. ]
>
>
> This patch implements Alex's suggestion for step 1 of String removal by ...
>
> * Replace String class internal buffer with an SBuf.
> * Move converters to/from String and SBuf from SBuf API to String API.
>
>
> This method allows all String code to be converted quickly to SBuf
> without so much worry about correct API conversion elsewhere around the
> code since the wrapper provides exemplar cut-n-paste code to work from.
>
> Addition of a SBuf constructor and toSBuf() accessor to String allows
> code using String to be converted directly to the SBuf API in smaller
> portions later. These obsolete the SBuf API converters to String and
> help reduce the SBuf API.
>
>
> Notes for auditing:
> Please audit this with a sole view of checking that the original
> String:: API semantics and behaviour are unchanged by the internals
> re-write.
> This patch seeks to *avoid* several things which would normally take up
> auditing time:
> * fixing any bugs in the String API semantics or behaviour
> * fixing any bugs in the code using String
> * using correct C++ coding styles or patterns.
>
> These bugs, behaviour and coding usage checks will be done on the
> following transition patches converting code variables from String to
> SBuf type.
>
> Amos
>

To avoid problems with NULL and defined() the callers of termedBuf()
have been given an audit and updated to check for and cope with "" empty
strings. And termedBuf() altered to return c_str() instead of NULL or
c_str().

NP: there seems to be a regression in SBuf::rfind() which is preventing
a fill unit-test run. But usage as a private proxy is not showing
anything amiss.

Amos

Received on Mon Dec 23 2013 - 03:07:22 MST

This archive was generated by hypermail 2.2.0 : Mon Dec 23 2013 - 12:00:13 MST