static const char foo = FOO;
On Sep 16, 2008, at 16:32, Stefan Sperling <stsp_at_elego.de> wrote:
> On Tue, Sep 16, 2008 at 12:32:35PM -0700, Greg Stein wrote:
>> On Tue, Sep 16, 2008 at 12:22 PM, <stsp_at_tigris.org> wrote:
>>> ...
>> \> +++ trunk/subversion/libsvn_subr/svn_string.c Tue Sep 16
>> 12:22:13
>> 2008 (r33104)
>>> @@ -417,6 +417,16 @@ svn_stringbuf_appendcstr(svn_stringbuf_t
>>> }
>>>
>>>
>>> +void
>>> +svn_stringbuf_appendchar(svn_stringbuf_t *targetstr,
>>> + char c)
>>> +{
>>> + char s[2];
>>> +
>>> + s[0] = c;
>>> + s[1] = '\0';
>>> + svn_stringbuf_appendbytes(targetstr, s, 1);
>>> +}
>>
>> That seems more complicated than it needs to be. appendbytes() won't
>> look at any bytes past the given length. The above can be wriiten
>> more
>> simply as:
>>
>> {
>> svn_stringbuf_appendbytes(targetstr, &c, 1);
>> }
>
> Thanks, r33107.
>
> I'd like to get rid of svn_stringbuf_appendchar altogether and
> just use svn_stringbuf_appendbytes directly, but unfortunately it's
> not possible to take the address of a literal char in C, so &('\n')
> won't work. libsvn_wc/tree_conflicts.c needs to append macros
> which expand to literal chars to a string.
>
> Stefan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
> For additional commands, e-mail: dev-help_at_subversion.tigris.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-09-16 22:36:39 CEST