apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From david reid <da...@jetnet.co.uk>
Subject Re: apr_uri_string_encode/decode
Date Wed, 02 Aug 2006 12:26:37 GMT
Nick Kew wrote:
> On Wednesday 02 August 2006 11:58, david reid wrote:
>> First pass at importing some apreq functions. Not yet had time to wirte
>> a test! Rushing out of door, so just a quick mail :-)
> 
> fairy nuff1
> 
> 
>> +/**
>> + * @fn apr_size_t apr_uri_query_string_encode(char *dest, const char *src,
>> +                                              const apr_size_t slen)
>> + * @brief URI encode a query string
>> + * @param dest the destination pointer
>> + * @param src the source pointer
>> + * @param slen length of source string
>> + */
>> +APU_DECLARE(apr_size_t) apr_uri_query_string_encode(char *, const char *,
>> +                                                    const apr_size_t);
> 
> No pool, so this presumably requires the destination to be already
> allocated.  Which in turn presumes a size computation (documentation?),
> and the user has done most of the work!  Or am I missing something?

That's sensible. As this was designed to be quick "import" of code I
didn't worry about changing things too much, but adding a version that
takes a pool and returns a new string may well be a good idea.

> 
> Also returning a size is not really APR-style, and is conspicuously at
> variance with ...

True. Again, these can easily be adapted to take a pool.

Bear in mind these are straight imports, with no extra work done. If we
want them to have a different interface then we can do that - it just
needs more than 2 mins to do it :-)

Of course it does raise the question about where should these live? If
we consider them to be "strings" function then they probably belong
inside apr's strings funcs, but if they are "uri" functions then this is
the correct place. Thoughts?

Looking at the util functions there is also a function to quote a
string, which probably does belong as a generic apr string function.

-- 
david

http://feathercast.org/

Mime
View raw message