qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Leon Alrae <leon.alrae@imgtec.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Liviu Ionescu <ilg@livius.net>,
	Christopher Covington <christopher.covington@linaro.org>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Matthew Fortune <matthew.fortune@imgtec.com>
Subject: Re: [Qemu-devel] [PATCH v2 2/2] semihosting: add --semihosting-config arg sub-argument
Date: Thu, 7 May 2015 17:18:58 +0100	[thread overview]
Message-ID: <554B9072.8060509@imgtec.com> (raw)
In-Reply-To: <CAFEAcA8bGU8dw9sabZb46C+paKJBPC0xK1bX8Wq6wGAHrGpeFA@mail.gmail.com>

On 07/05/2015 14:02, Peter Maydell 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;
>> +    }
> 
> Consider using a glib pointer array? Then this is just
> a call to g_pointer_array_add().

glib pointer array certainly simplifies managing an array of pointers,
but I think in this case we wouldn't benefit much from it as the array
is set here only and never modified later. Also people not familiar with
glib pointer arrays may find raw int argc and const char **argv fields
clearer than GPtrArray type.
I'll leave it as it is, but if anyone has strong preference on using
g_ptr_array I don't mind updating the patch as changes are trivial.

Thanks,
Leon

      reply	other threads:[~2015-05-07 16:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-07 11:49 [Qemu-devel] [PATCH v2 0/2] semihosting: clean up and add --semihosting-config arg Leon Alrae
2015-05-07 11:49 ` [Qemu-devel] [PATCH v2 1/2] semihosting: create SemihostingConfig structure and semihost.h Leon Alrae
2015-05-07 12:40   ` Peter Maydell
2015-05-07 11:49 ` [Qemu-devel] [PATCH v2 2/2] semihosting: add --semihosting-config arg sub-argument Leon Alrae
2015-05-07 13:02   ` Peter Maydell
2015-05-07 16:18     ` Leon Alrae [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=554B9072.8060509@imgtec.com \
    --to=leon.alrae@imgtec.com \
    --cc=christopher.covington@linaro.org \
    --cc=ilg@livius.net \
    --cc=matthew.fortune@imgtec.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).