qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, pbonzini@redhat.com, armbru@redhat.com
Subject: [PATCH v2 3/3] char: Simplify chardev_name_foreach()
Date: Thu, 11 Mar 2021 17:42:53 +0100	[thread overview]
Message-ID: <20210311164253.338723-4-kwolf@redhat.com> (raw)
In-Reply-To: <20210311164253.338723-1-kwolf@redhat.com>

Both callers use callbacks that don't do anything when they are called
for CLI aliases. Instead of passing the cli_alias parameter, just don't
call the callbacks for aliases in the first place.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 chardev/char.c | 24 +++++-------------------
 1 file changed, 5 insertions(+), 19 deletions(-)

diff --git a/chardev/char.c b/chardev/char.c
index 7be9579dd8..140d6d9d36 100644
--- a/chardev/char.c
+++ b/chardev/char.c
@@ -548,7 +548,7 @@ static struct ChardevAlias {
 };
 
 typedef struct ChadevClassFE {
-    void (*fn)(const char *name, bool is_cli_alias, void *opaque);
+    void (*fn)(const char *name, void *opaque);
     void *opaque;
 } ChadevClassFE;
 
@@ -562,33 +562,23 @@ chardev_class_foreach(ObjectClass *klass, void *opaque)
         return;
     }
 
-    fe->fn(object_class_get_name(klass) + 8, false, fe->opaque);
+    fe->fn(object_class_get_name(klass) + 8, fe->opaque);
 }
 
 static void
-chardev_name_foreach(void (*fn)(const char *name, bool is_cli_alias,
-                                void *opaque),
+chardev_name_foreach(void (*fn)(const char *name, void *opaque),
                      void *opaque)
 {
     ChadevClassFE fe = { .fn = fn, .opaque = opaque };
-    int i;
 
     object_class_foreach(chardev_class_foreach, TYPE_CHARDEV, false, &fe);
-
-    for (i = 0; i < (int)ARRAY_SIZE(chardev_alias_table); i++) {
-        fn(chardev_alias_table[i].alias, true, opaque);
-    }
 }
 
 static void
-help_string_append(const char *name, bool is_cli_alias, void *opaque)
+help_string_append(const char *name, void *opaque)
 {
     GString *str = opaque;
 
-    if (is_cli_alias) {
-        return;
-    }
-
     g_string_append_printf(str, "\n  %s", name);
 }
 
@@ -810,15 +800,11 @@ ChardevInfoList *qmp_query_chardev(Error **errp)
 }
 
 static void
-qmp_prepend_backend(const char *name, bool is_cli_alias, void *opaque)
+qmp_prepend_backend(const char *name, void *opaque)
 {
     ChardevBackendInfoList **list = opaque;
     ChardevBackendInfo *value;
 
-    if (is_cli_alias) {
-        return;
-    }
-
     value = g_new0(ChardevBackendInfo, 1);
     value->name = g_strdup(name);
     QAPI_LIST_PREPEND(*list, value);
-- 
2.29.2



  parent reply	other threads:[~2021-03-11 16:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-11 16:42 [PATCH v2 0/3] char: Deprecate backend aliases Kevin Wolf
2021-03-11 16:42 ` [PATCH v2 1/3] char: Skip CLI aliases in query-chardev-backends Kevin Wolf
2021-03-11 16:42 ` [PATCH v2 2/3] char: Deprecate backend aliases 'tty' and 'parport' Kevin Wolf
2021-03-11 16:42 ` Kevin Wolf [this message]
2021-03-12  8:34 ` [PATCH v2 0/3] char: Deprecate backend aliases Markus Armbruster

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=20210311164253.338723-4-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=armbru@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).