> On 06 May 2015, at 17:57, Leon Alrae <leon.al...@imgtec.com> wrote:
> 
> +static int add_semihosting_arg(const char *name, const char *val, void 
> *opaque)
> +{
> +    SemihostingConfig *s = opaque;
> +    if (strcmp(name, "arg") == 0) {
> +        s->argc++;
> +        s->argv = g_realloc(s->argv, s->argc * sizeof(void *));
> +        s->argv[s->argc - 1] = val;
> +    }
> +    return 0;
> +}

being done at init time probably it has no impact, but, as a matter of style, I 
would avoid iterating realloc when the buffer size is actually known.

is it that difficult to count the "arg"s and correctly alloc the array?


regards,

Liviu


Reply via email to