apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <...@covalent.net>
Subject Re: apr_pstrcat()
Date Sun, 08 Jul 2001 05:42:15 GMT
On Sun, 8 Jul 2001, Cliff Woolley wrote:

> You know, it'd be really cool if there were a version of apr_pstrcat()
> that returned the length of the concatenated output.  There are LOTS of
> places where we call apr_pstrcat() and then immediately have to call
> strlen() on its output, when apr_pstrcat() itself is already computing the
> length *twice*.  Would anybody mind if I added an apr_pstrlencat() or
> something like that?  [Anybody got a better name?  I'm all ears.] Either
> the length or the output string would have to be returned via reference in
> the parameter list, obviously... I'm not sure which is better.  Thoughts?

+1, personally I would prefer to have the length returned in the parameter
list.  Or, we could do something I have been considering since I started
APR.  We could create an apr_string_t.  This would be a simple type, with
just a char * and a length.  The goal would be to use an apr_string_t
whenever we already have a length.  I would love to find a way to pack the
length into a simple C string, but since that isn't really possible, I
think creating a new string type might make sense.


Ryan Bloom                        	rbb@apache.org
Covalent Technologies			rbb@covalent.net

View raw message