You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Stefan Sperling <st...@elego.de> on 2008/09/16 20:32:06 UTC

Re: svn commit: r33104 - in trunk/subversion: include libsvn_subr libsvn_wc

On Tue, Sep 16, 2008 at 12:32:35PM -0700, Greg Stein wrote:
> On Tue, Sep 16, 2008 at 12:22 PM,  <st...@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@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: r33104 - in trunk/subversion: include libsvn_subr libsvn_wc

Posted by Stefan Sperling <st...@elego.de>.
On Tue, Sep 16, 2008 at 04:35:55PM -0400, Greg Stein wrote:
> static const char foo = FOO;

Hah. Nice one. r33108.

Thanks,
Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: r33104 - in trunk/subversion: include libsvn_subr libsvn_wc

Posted by Greg Stein <gs...@gmail.com>.
static const char foo = FOO;



On Sep 16, 2008, at 16:32, Stefan Sperling <st...@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,  <st...@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@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org