qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Nguyen Dinh Phi <phind.uet@gmail.com>
Cc: Laurent Vivier <laurent@vivier.eu>,  qemu-devel@nongnu.org
Subject: Re: [PATCH] linux-user: replace calloc() with g_new0()
Date: Sun, 17 Mar 2024 20:38:50 +0000	[thread overview]
Message-ID: <87sf0or3tx.fsf@draig.linaro.org> (raw)
In-Reply-To: <20240317171747.1642207-1-phind.uet@gmail.com> (Nguyen Dinh Phi's message of "Mon, 18 Mar 2024 01:17:47 +0800")

Nguyen Dinh Phi <phind.uet@gmail.com> writes:

> Use glib allocation as recommended by the coding convention
>
> Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com>
> ---
>  linux-user/main.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/linux-user/main.c b/linux-user/main.c
> index 9277df2e9d..149e35432e 100644
> --- a/linux-user/main.c
> +++ b/linux-user/main.c
> @@ -928,11 +928,7 @@ int main(int argc, char **argv, char **envp)
>       * Prepare copy of argv vector for target.
>       */
>      target_argc = argc - optind;
> -    target_argv = calloc(target_argc + 1, sizeof (char *));
> -    if (target_argv == NULL) {
> -        (void) fprintf(stderr, "Unable to allocate memory for target_argv\n");
> -        exit(EXIT_FAILURE);
> -    }
> +    target_argv = g_new0(char *, target_argc + 1);

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


  reply	other threads:[~2024-03-17 20:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-17 17:17 [PATCH] linux-user: replace calloc() with g_new0() Nguyen Dinh Phi
2024-03-17 20:38 ` Alex Bennée [this message]
2024-04-06 19:31 ` Richard Henderson

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=87sf0or3tx.fsf@draig.linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=laurent@vivier.eu \
    --cc=phind.uet@gmail.com \
    --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).