qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Nguyen Dinh Phi <phind.uet@gmail.com>,
	Laurent Vivier <laurent@vivier.eu>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH] linux-user: replace calloc() with g_new0()
Date: Sat, 6 Apr 2024 09:31:07 -1000	[thread overview]
Message-ID: <d7fdb4d2-afab-4379-947c-d8db7c1b2830@linaro.org> (raw)
In-Reply-To: <20240317171747.1642207-1-phind.uet@gmail.com>

On 3/17/24 07:17, Nguyen Dinh Phi wrote:
> 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);
>   
>       /*
>        * If argv0 is specified (using '-0' switch) we replace

Queued, thanks.


r~


      parent reply	other threads:[~2024-04-06 19:32 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
2024-04-06 19:31 ` Richard Henderson [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=d7fdb4d2-afab-4379-947c-d8db7c1b2830@linaro.org \
    --to=richard.henderson@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).