Re: [PATCH] - improved decoding of URL special characters

Dustin Kirkland <[email protected]> Wed, 19 Oct 2005 16:20:37 -0500
Newsgroups gmane.comp.multimedia.xmms.devel
Message-ID <[email protected]>
On 10/19/05, Andrew Sveikauskas <[email protected]> wrote:
> Why is text in urldecodestr a char ** and not char *?  It never sets *text to
> anything, so there's no point in making it char **, unless I'm not seeing
> something.

Good question.  The starting address of *text won't change, however
the data within it will.  I made it a char ** just to note that the
data inside there is likely to be modified.  Not necessary and easily
changed.  I just thought it might make it more obvious to the caller
that the input string is to be modified.

> My humble opinion is that a better urldecodestr()-type function would look
> like this.  Notably, let the libc do the hex conversion.  This also does
> less copies if the string consists of more than one %xx sequence.

I just tested your function and it works just as well.  I iterated
both mine and yours in a little test function over 10,000 urls, each
having multiple characters to replace and they both executed
repeatedly in 14-15 seconds, so I don't see a performance difference
in either implementation.

I think it's a matter of taste, and I don't particularly care if my
patch or yours (I assume a patch would come along) were eventually
accepted.  I'd just like to see this functionality at some point in
the mainline xmms ;)


:-Dustin