Re: StringNg review: MemBlob

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Tue, 21 Sep 2010 22:31:44 -0600

On 09/20/2010 08:18 PM, Alex Rousskov wrote:
> On 09/03/2010 09:21 AM, Kinkie wrote:
>
>> You'll find the branch at lp:~kinkie/squid/stringng
...
> Comments for MemBlob.cci r9472:

Found one more:

> * \note memcpy is used as the copying function. This is safe,
> * because it is guarranteed by design that the copied-to
> * memory area is only owned by the appended-to string,
> * and thus doesn't overlap with the appended-from area
> */
> void
> MemBlob::append(const char *S, const MemBlob::size_type Ssize)
> {
> memcpy(mem+bufUsed,S,Ssize);
> bufUsed+=Ssize;
> ++stats.append;
> }

The \note is correct, but we should not mention "string" in MemBlob.cci.
MemBlob does not (or should not) know what its users are. There may be a
better way to express the same thought. Consider:

     \none memcpy() is safe because we copy to an unused area

The note belongs to the append() implementation, not its description.

Thank you,

Alex.
Received on Wed Sep 22 2010 - 04:31:46 MDT

This archive was generated by hypermail 2.2.0 : Wed Sep 22 2010 - 12:00:07 MDT