aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tool_urlglob.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/tool_urlglob.c b/src/tool_urlglob.c
index aa87e5a37..ec5014b97 100644
--- a/src/tool_urlglob.c
+++ b/src/tool_urlglob.c
@@ -40,8 +40,7 @@ typedef enum {
void glob_cleanup(URLGlob* glob);
-static GlobCode glob_fixed(URLGlob *glob, unsigned long *amount,
- char *fixed, size_t len)
+static GlobCode glob_fixed(URLGlob *glob, char *fixed, size_t len)
{
URLPattern *pat = &glob->pattern[glob->size];
pat->type = UPTSet;
@@ -49,8 +48,6 @@ static GlobCode glob_fixed(URLGlob *glob, unsigned long *amount,
pat->content.Set.ptr_s = 0;
pat->globindex = -1;
- (*amount)++;
-
pat->content.Set.elements = malloc(sizeof(char*));
if(!pat->content.Set.elements)
@@ -314,6 +311,8 @@ static GlobCode glob_parse(URLGlob *glob, char *pattern,
GlobCode res = GLOB_OK;
int globindex = 0; /* count "actual" globs */
+ *amount = 1;
+
while(*pattern && !res) {
char *buf = glob->glob_buffer;
int sublen = 0;
@@ -337,12 +336,9 @@ static GlobCode glob_parse(URLGlob *glob, char *pattern,
if(sublen) {
/* we got a literal string, add it as a single-item list */
*buf = '\0';
- res = glob_fixed(glob, amount, glob->glob_buffer, sublen);
+ res = glob_fixed(glob, glob->glob_buffer, sublen);
}
else {
- if(!*amount)
- *amount = 1;
-
switch (*pattern) {
case '\0': /* done */
break;