mirror of
https://github.com/mirror/wget.git
synced 2025-03-01 21:30:20 +08:00
* src/convert.c (convert_links_in_hashtable): Remove use of alloca
This commit is contained in:
parent
ca56ca94ee
commit
28beee5e75
@ -64,17 +64,17 @@ convert_links_in_hashtable (struct hash_table *downloaded_set,
|
|||||||
int is_css,
|
int is_css,
|
||||||
int *file_count)
|
int *file_count)
|
||||||
{
|
{
|
||||||
int i;
|
int i, cnt = 0;
|
||||||
|
char *arr[1024], **file_array;
|
||||||
|
|
||||||
int cnt;
|
if (!downloaded_set || (cnt = hash_table_count (downloaded_set)) == 0)
|
||||||
char **file_array;
|
|
||||||
|
|
||||||
cnt = 0;
|
|
||||||
if (downloaded_set)
|
|
||||||
cnt = hash_table_count (downloaded_set);
|
|
||||||
if (cnt == 0)
|
|
||||||
return;
|
return;
|
||||||
file_array = alloca_array (char *, cnt);
|
|
||||||
|
if (cnt <= (int) countof (arr))
|
||||||
|
file_array = arr;
|
||||||
|
else
|
||||||
|
file_array = xmalloc (cnt * sizeof (arr[0]));
|
||||||
|
|
||||||
string_set_to_array (downloaded_set, file_array);
|
string_set_to_array (downloaded_set, file_array);
|
||||||
|
|
||||||
for (i = 0; i < cnt; i++)
|
for (i = 0; i < cnt; i++)
|
||||||
@ -166,6 +166,9 @@ convert_links_in_hashtable (struct hash_table *downloaded_set,
|
|||||||
/* Free the data. */
|
/* Free the data. */
|
||||||
free_urlpos (urls);
|
free_urlpos (urls);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (file_array != arr)
|
||||||
|
xfree (file_array);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function is called when the retrieval is done to convert the
|
/* This function is called when the retrieval is done to convert the
|
||||||
|
Loading…
Reference in New Issue
Block a user