review fixes and a testcase

This commit is contained in:
BVK Chaitanya 2010-08-09 21:42:24 +05:30
parent b0ecfcd360
commit 67a9e4d95d
8 changed files with 119 additions and 17 deletions

View file

@ -201,7 +201,7 @@ grub_script_arglist_to_argv (struct grub_script_arglist *arglist,
grub_script_argv_append (&result, arg->str) ||
grub_script_argv_append (&result, "}"))
goto fail;
result.script = grub_script_get (arg->script);
result.script = arg->script;
break;
case GRUB_SCRIPT_ARG_TYPE_TEXT:

View file

@ -34,7 +34,7 @@ grub_normal_parse_line (char *line, grub_reader_getline_t getline)
grub_script_execute (parsed_script);
/* The parsed script was executed, throw it away. */
grub_script_put (parsed_script);
grub_script_unref (parsed_script);
}
return grub_errno;

View file

@ -208,9 +208,9 @@ block: "{"
/* restore old scripts; append $$->script to siblings. */
state->scripts = $<scripts>2 ?: $$->script;
if (s) {
while (s->siblings)
s = s->siblings;
s->siblings = $$->script;
while (s->next_siblings)
s = s->next_siblings;
s->next_siblings = $$->script;
}
}
@ -243,11 +243,12 @@ grubcmd: word arguments0 block0
if ($3)
x = grub_script_add_arglist (state, $2, $3);
if ($1 && x) {
$1->next = x;
$1->argcount += x->argcount;
x->argcount = 0;
}
if ($1 && x)
{
$1->next = x;
$1->argcount += x->argcount;
x->argcount = 0;
}
$$ = grub_script_create_cmdline (state, $1);
}
;

View file

@ -105,8 +105,8 @@ grub_script_free (struct grub_script *script)
s = script->children;
while (s) {
t = s->siblings;
grub_script_put (s);
t = s->next_siblings;
grub_script_unref (s);
s = t;
}
grub_free (script);
@ -355,8 +355,8 @@ grub_script_create (struct grub_script_cmd *cmd, struct grub_script_mem *mem)
parsed->mem = mem;
parsed->cmd = cmd;
parsed->refcnt = 0;
parsed->siblings = 0;
parsed->children = 0;
parsed->next_siblings = 0;
return parsed;
}