Cleanup cmd_string_uppercase

This commit is contained in:
Ángel González 2013-06-22 00:06:31 +02:00 committed by Giuseppe Scrivano
parent 4df7703d62
commit 49f6d0ded8
2 changed files with 12 additions and 7 deletions

View File

@ -1,3 +1,7 @@
2013-06-22 Ángel González <keisial@gmail.com>
* init.c (cmd_string_uppercase): Rewrite function.
2013-06-19 Tim Ruehsen <tim.ruehsen@gmx.de>
* connect.c (socket_ip_address): zero out ip address structure to

View File

@ -965,15 +965,16 @@ cmd_string (const char *com, const char *val, void *place)
static bool
cmd_string_uppercase (const char *com, const char *val, void *place)
{
char *q;
bool ret = cmd_string (com, val, place);
q = *((char **) place);
if (!ret || q == NULL)
return false;
char *q, **pstring;
pstring = (char **)place;
xfree_null (*pstring);
for ( ;*q; *q++)
*q = c_toupper (*q);
*pstring = xmalloc (strlen (val) + 1);
for (q = *pstring; *val; val++, q++)
*q = c_toupper (*val);
*q = '\0';
return true;
}