Minor rewriting.

This commit is contained in:
svdijk 2013-03-17 21:32:50 +01:00
parent e49693bec4
commit 317355f7ca
2 changed files with 7 additions and 11 deletions

View file

@ -700,13 +700,11 @@ Cmd_AddCommand(char *cmd_name, xcommand_t function)
cmd->name = cmd_name;
cmd->function = function;
/* link the command in */
for (pos = &cmd_functions; *pos; pos = &(*pos)->next)
/* link the command in */
pos = &cmd_functions;
while (*pos && strcmp((*pos)->name, cmd->name) < 0)
{
if (strcmp(cmd->name, (*pos)->name) < 0)
{
break;
}
pos = &(*pos)->next;
}
cmd->next = *pos;
*pos = cmd;

View file

@ -177,12 +177,10 @@ Cvar_Get(char *var_name, char *var_value, int flags)
var->value = strtod(var->string, (char **)NULL);
/* link the variable in */
for (pos = &cvar_vars; *pos; pos = &(*pos)->next)
pos = &cvar_vars;
while (*pos && strcmp((*pos)->name, var->name) < 0)
{
if (strcmp(var->name, (*pos)->name) < 0)
{
break;
}
pos = &(*pos)->next;
}
var->next = *pos;
*pos = var;