From da35782a8557d6d11ef251507f9bc87393bc4241 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Fri, 5 Oct 2012 12:15:39 +0000 Subject: [PATCH] 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. --- filters.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) 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) { -- 2.39.2