diff options
author | Daniel Stenberg <daniel@haxx.se> | 2000-10-12 09:12:24 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2000-10-12 09:12:24 +0000 |
commit | 4e8ddedc8fd186ec6691e7750146b832e44ace8d (patch) | |
tree | a0c669339fc03c2e6bfa58e42250a760967bcefe /src | |
parent | 751d503f54596d6d86f969683fec2fe296d9d1f0 (diff) | |
download | curl-4e8ddedc8fd186ec6691e7750146b832e44ace8d.tar.gz |
Jörn added glob_cleanup()
Diffstat (limited to 'src')
-rw-r--r-- | src/urlglob.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/urlglob.c b/src/urlglob.c index 69d1e9b5e..01962f078 100644 --- a/src/urlglob.c +++ b/src/urlglob.c @@ -222,6 +222,24 @@ int glob_url(URLGlob** glob, char* url, int *urlnum) return CURLE_OK; } +void glob_cleanup(URLGlob* glob) { + int i, elem; + + for (i = glob->size - 1; i >= 0; --i) { + if (!(i & 1)) { /* even indexes contain literals */ + free(glob->literal[i/2]); + } else { /* odd indexes contain sets or ranges */ + if (glob->pattern[i/2].type == UPTSet) { + for (elem = glob->pattern[i/2].content.Set.size - 1; elem >= 0; --elem) { + free(glob->pattern[i/2].content.Set.elements[elem]); + } + free(glob->pattern[i/2].content.Set.elements); + } + } + } + free(glob); +} + char *next_url(URLGlob *glob) { static int beenhere = 0; |