From: Fabian Keil Date: Mon, 14 Apr 2008 18:11:21 +0000 (+0000) Subject: The compiler might not notice it, but the buffer passed to X-Git-Tag: v_3_0_9~155 X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=commitdiff_plain;h=1d2a21ed0350fd3cad3b8e08f9c72fd3404d5c3b The compiler might not notice it, but the buffer passed to create_url_spec() is modified later on and thus shouldn't be declared immutable. --- diff --git a/urlmatch.c b/urlmatch.c index 0ddd57a7..6e84bc3c 100644 --- a/urlmatch.c +++ b/urlmatch.c @@ -1,4 +1,4 @@ -const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.33 2008/04/12 14:03:13 fabiankeil Exp $"; +const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.34 2008/04/13 13:32:07 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/urlmatch.c,v $ @@ -33,6 +33,9 @@ const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.33 2008/04/12 14:03:13 fabianke * * Revisions : * $Log: urlmatch.c,v $ + * Revision 1.34 2008/04/13 13:32:07 fabiankeil + * Factor URL pattern compilation out of create_url_spec(). + * * Revision 1.33 2008/04/12 14:03:13 fabiankeil * Remove an obvious comment and improve another one. * @@ -1070,7 +1073,7 @@ static int domain_match(const struct url_spec *pattern, const struct http_reques * function. If this function succeeds, the * buffer is copied to url->spec. If this * function fails, the contents of the buffer - * are lost forever. XXX: Why is this const? + * are lost forever. * * Returns : JB_ERR_OK - Success * JB_ERR_MEMORY - Out of memory @@ -1078,7 +1081,7 @@ static int domain_match(const struct url_spec *pattern, const struct http_reques * written to system log) * *********************************************************************/ -jb_err create_url_spec(struct url_spec * url, const char * buf) +jb_err create_url_spec(struct url_spec *url, char *buf) { assert(url); assert(buf); diff --git a/urlmatch.h b/urlmatch.h index 8f55e6d5..975e7d41 100644 --- a/urlmatch.h +++ b/urlmatch.h @@ -1,6 +1,6 @@ #ifndef URLMATCH_H_INCLUDED #define URLMATCH_H_INCLUDED -#define URLMATCH_H_VERSION "$Id: urlmatch.h,v 1.8 2007/09/02 15:31:20 fabiankeil Exp $" +#define URLMATCH_H_VERSION "$Id: urlmatch.h,v 1.9 2008/04/08 16:07:39 fabiankeil Exp $" /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/urlmatch.h,v $ @@ -35,6 +35,10 @@ * * Revisions : * $Log: urlmatch.h,v $ + * Revision 1.9 2008/04/08 16:07:39 fabiankeil + * Make it harder to mistake url_match()'s + * second parameter for an url_spec. + * * Revision 1.8 2007/09/02 15:31:20 fabiankeil * Move match_portlist() from filter.c to urlmatch.c. * It's used for url matching, not for filtering. @@ -95,7 +99,7 @@ extern jb_err parse_http_url(const char * url, extern int url_match(const struct url_spec *pattern, const struct http_request *http); -extern jb_err create_url_spec(struct url_spec * url, const char * buf); +extern jb_err create_url_spec(struct url_spec *url, char *buf); extern void free_url_spec(struct url_spec *url); extern int match_portlist(const char *portlist, int port);