* grub-core/lib/arg.c: Don't discard const attribute.
This commit is contained in:
parent
05126706b0
commit
2622b1e8a8
2 changed files with 15 additions and 11 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/lib/arg.c: Don't discard const attribute.
|
||||||
|
|
||||||
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
|
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* grub-core/kern/dl.c: Don't discard const attribute.
|
* grub-core/kern/dl.c: Don't discard const attribute.
|
||||||
|
|
|
@ -35,22 +35,22 @@ static const struct grub_arg_option help_options[] =
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Helper for find_short. */
|
/* Helper for find_short. */
|
||||||
static struct grub_arg_option *
|
static const struct grub_arg_option *
|
||||||
fnd_short (const struct grub_arg_option *opt, char c)
|
fnd_short (const struct grub_arg_option *opt, char c)
|
||||||
{
|
{
|
||||||
while (opt->doc)
|
while (opt->doc)
|
||||||
{
|
{
|
||||||
if (opt->shortarg == c)
|
if (opt->shortarg == c)
|
||||||
return (struct grub_arg_option *) opt;
|
return opt;
|
||||||
opt++;
|
opt++;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct grub_arg_option *
|
static const struct grub_arg_option *
|
||||||
find_short (const struct grub_arg_option *options, char c)
|
find_short (const struct grub_arg_option *options, char c)
|
||||||
{
|
{
|
||||||
struct grub_arg_option *found = 0;
|
const struct grub_arg_option *found = 0;
|
||||||
|
|
||||||
if (options)
|
if (options)
|
||||||
found = fnd_short (options, c);
|
found = fnd_short (options, c);
|
||||||
|
@ -60,11 +60,11 @@ find_short (const struct grub_arg_option *options, char c)
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
case 'h':
|
case 'h':
|
||||||
found = (struct grub_arg_option *) help_options;
|
found = help_options;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'u':
|
case 'u':
|
||||||
found = (struct grub_arg_option *) (help_options + 1);
|
found = (help_options + 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -76,23 +76,23 @@ find_short (const struct grub_arg_option *options, char c)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Helper for find_long. */
|
/* Helper for find_long. */
|
||||||
static struct grub_arg_option *
|
static const struct grub_arg_option *
|
||||||
fnd_long (const struct grub_arg_option *opt, const char *s, int len)
|
fnd_long (const struct grub_arg_option *opt, const char *s, int len)
|
||||||
{
|
{
|
||||||
while (opt->doc)
|
while (opt->doc)
|
||||||
{
|
{
|
||||||
if (opt->longarg && ! grub_strncmp (opt->longarg, s, len) &&
|
if (opt->longarg && ! grub_strncmp (opt->longarg, s, len) &&
|
||||||
opt->longarg[len] == '\0')
|
opt->longarg[len] == '\0')
|
||||||
return (struct grub_arg_option *) opt;
|
return opt;
|
||||||
opt++;
|
opt++;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct grub_arg_option *
|
static const struct grub_arg_option *
|
||||||
find_long (const struct grub_arg_option *options, const char *s, int len)
|
find_long (const struct grub_arg_option *options, const char *s, int len)
|
||||||
{
|
{
|
||||||
struct grub_arg_option *found = 0;
|
const struct grub_arg_option *found = 0;
|
||||||
|
|
||||||
if (options)
|
if (options)
|
||||||
found = fnd_long (options, s, len);
|
found = fnd_long (options, s, len);
|
||||||
|
@ -240,7 +240,7 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
|
||||||
for (curarg = 0; curarg < argc; curarg++)
|
for (curarg = 0; curarg < argc; curarg++)
|
||||||
{
|
{
|
||||||
char *arg = argv[curarg];
|
char *arg = argv[curarg];
|
||||||
struct grub_arg_option *opt;
|
const struct grub_arg_option *opt;
|
||||||
char *option = 0;
|
char *option = 0;
|
||||||
|
|
||||||
/* No option is used. */
|
/* No option is used. */
|
||||||
|
|
Loading…
Reference in a new issue