qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: eesposit@redhat.com, alex.bennee@linaro.org
Subject: Re: [PATCH] qgraph: implement stack as a linked list
Date: Tue, 11 Oct 2022 08:29:10 -0700	[thread overview]
Message-ID: <c8592d26-6cac-1e6e-cb7f-ac91f7966890@linaro.org> (raw)
In-Reply-To: <20221011104649.324963-1-pbonzini@redhat.com>

On 10/11/22 03:46, Paolo Bonzini wrote:
>   {
> +    QOSStackElement *elem = g_new0(QOSStackElement, 1);
>       int len = 0; /* root is not counted */
> -    if (qos_node_tos == QOS_PATH_MAX_ELEMENT_SIZE) {
> -        g_printerr("QOSStack: full stack, cannot push");
> -        abort();
> -    }
> -
>       if (parent) {
>           len = parent->length + 1;
>       }
> -    qos_node_stack[qos_node_tos++] = (QOSStackElement) {
> +    *elem = (QOSStackElement) {
>           .node = el,
>           .parent = parent,
>           .parent_edge = e,
>           .length = len,
>       };
> -}

If you're going to completely initialize the structure via assignment, you don't need to 
zero the storage first.  I suggest either g_new + structure assignment or g_new0 + 
sequence of element assignments.

Otherwise,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~


  reply	other threads:[~2022-10-11 15:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-11 10:46 [PATCH] qgraph: implement stack as a linked list Paolo Bonzini
2022-10-11 15:29 ` Richard Henderson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-10-12  9:08 Paolo Bonzini

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=c8592d26-6cac-1e6e-cb7f-ac91f7966890@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=eesposit@redhat.com \
    --cc=pbonzini@redhat.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).