From: Fabian Keil Date: Fri, 5 Oct 2012 12:15:39 +0000 (+0000) Subject: Move a couple of variable declarations in get_last_url() to the beginning of their... X-Git-Tag: v_3_0_20~265 X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=commitdiff_plain;h=da35782a8557d6d11ef251507f9bc87393bc4241;hp=57572d756236b46786d4bb1af11bba40aa5d573a Move a couple of variable declarations in get_last_url() to the beginning of their code block It's how we usually do it and is apparently also required when compiling with gcc 2.95. Initial patch submitted by Simon South in #3564815. --- diff --git a/filters.c b/filters.c index a94454c1..65308f5c 100644 --- a/filters.c +++ b/filters.c @@ -1,4 +1,4 @@ -const char filters_rcs[] = "$Id: filters.c,v 1.171 2012/03/18 13:47:33 fabiankeil Exp $"; +const char filters_rcs[] = "$Id: filters.c,v 1.172 2012/06/08 15:15:11 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/filters.c,v $ @@ -1088,6 +1088,11 @@ char *get_last_url(char *subject, const char *redirect_mode) if (0 == strcmpic(redirect_mode, "check-decoded-url") && strchr(subject, '%')) { + char *url_segment = NULL; + char **url_segments; + size_t max_segments; + int segments; + log_error(LOG_LEVEL_REDIRECTS, "Checking \"%s\" for encoded redirects.", subject); @@ -1097,15 +1102,12 @@ char *get_last_url(char *subject, const char *redirect_mode) * go backwards through the segments, URL-decode them * and look for a URL in the decoded result. * Stop the search after the first match. - */ - char *url_segment = NULL; - /* + * * XXX: This estimate is guaranteed to be high enough as we * let ssplit() ignore empty fields, but also a bit wasteful. */ - size_t max_segments = strlen(subject) / 2; - char **url_segments = malloc(max_segments * sizeof(char *)); - int segments; + max_segments = strlen(subject) / 2; + url_segments = malloc(max_segments * sizeof(char *)); if (NULL == url_segments) {