mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
Do not free/duplicate current/remote encoding string if they aren't changed
This commit is contained in:
parent
b30a0dd817
commit
c31e00b52d
30
src/iri.c
30
src/iri.c
@ -337,18 +337,27 @@ void set_current_charset (char *charset)
|
||||
{
|
||||
/*printf("[ current = `%s'\n", charset);*/
|
||||
if (current)
|
||||
xfree (current);
|
||||
{
|
||||
/* Do nothing if already equal */
|
||||
if (!strcasecmp (current, charset))
|
||||
return;
|
||||
xfree (current);
|
||||
}
|
||||
|
||||
current = charset ? xstrdup (charset) : NULL;
|
||||
}
|
||||
|
||||
void set_current_as_locale (void)
|
||||
{
|
||||
/* sXXXav : assert opt.locale NULL ? */
|
||||
/*printf("[ current = locale = `%s'\n", opt.locale);*/
|
||||
if (current)
|
||||
xfree (current);
|
||||
{
|
||||
if (!strcasecmp (current, opt.locale))
|
||||
return;
|
||||
xfree (current);
|
||||
}
|
||||
|
||||
/* sXXXav : assert opt.locale NULL ? */
|
||||
current = xstrdup (opt.locale);
|
||||
}
|
||||
|
||||
@ -357,8 +366,12 @@ set_remote_charset (char *charset)
|
||||
{
|
||||
/*printf("[ remote = `%s'\n", charset);*/
|
||||
if (remote)
|
||||
xfree (remote);
|
||||
|
||||
{
|
||||
/* Do nothing if already equal */
|
||||
if (!strcasecmp (remote, charset))
|
||||
return;
|
||||
xfree (remote);
|
||||
}
|
||||
remote = charset ? xstrdup (charset) : NULL;
|
||||
}
|
||||
|
||||
@ -367,7 +380,12 @@ set_remote_as_current (void)
|
||||
{
|
||||
/*printf("[ remote = current = `%s'\n", current);*/
|
||||
if (remote)
|
||||
xfree (remote);
|
||||
{
|
||||
/* Do nothing if already equal */
|
||||
if (current && !strcasecmp (remote, current))
|
||||
return;
|
||||
xfree (remote);
|
||||
}
|
||||
|
||||
remote = current ? xstrdup (current) : NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user