httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexei Kosut <ako...@organic.com>
Subject Re: [PATCH] Enable sortable columns in FancyIndexed directories
Date Thu, 24 Jul 1997 05:59:21 GMT
On Wed, 23 Jul 1997, Dean Gaudet wrote:

> I haven't tested this, but it looks fine except:
> 
> On Wed, 23 Jul 1997, Rodent of Unusual Size wrote:
> 
> > +static void emit_link(request_rec *r, char *anchor, char fname, char curkey,
> > +		      char curdirection)
> > +{
> > +    char *qvalue = "?.=.";
> > +    int reverse;
> > +
> > +    qvalue[1] = fname;
> > +    reverse = ((curkey == fname) && (curdirection == D_ASCENDING));
> > +    qvalue[3] = reverse ? D_DESCENDING : D_ASCENDING;
> > +    rvputs (r, "<A HREF=\"", qvalue, "\">", anchor, "</A>", NULL);
> > +}
> 
> qvalue points to a const char *... which most compilers don't warn about
> because it's such a common problem.  Your code here isn't thread safe.
> It should be something like:

Or just

char qvalue = pstrdup(r->pool, "?.=.");

The Apache code actually uses that sort of construct a lot, probably
uneccessarily in a lot of places.

But in this instance, this should work too (I think):

char qvalue[] = "?.=.";

-- Alexei Kosut <akosut@organic.com>


Mime
View raw message