mirror of
https://github.com/curl/curl.git
synced 2026-04-15 01:51:41 +03:00
Jrn added glob_cleanup()
This commit is contained in:
parent
751d503f54
commit
4e8ddedc8f
1 changed files with 18 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue