qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Yuval Shaia <yuval.shaia@oracle.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>,
	Max Reitz <mreitz@redhat.com>,
	Marcel Apfelbaum <marcel@redhat.com>
Subject: Re: [Qemu-devel] [PULL, 08/36] qapi: Remove qobject_to_X() functions
Date: Thu, 12 Apr 2018 20:51:45 +0300	[thread overview]
Message-ID: <20180412175140.GA5406@yuvallap> (raw)
In-Reply-To: <20180312183628.394722-9-eblake@redhat.com>

Hi Eric,

On Mon, Mar 12, 2018 at 01:35:59PM -0500, Eric Blake wrote:
> From: Max Reitz <mreitz@redhat.com>
> 
> They are no longer needed now.

I'm doing some off-list development which use these functions.
Unfortunately i'm not subscribed (yet) to qemu-devel so obviously missed
this email.

Is there any alternative to these functions?

My code looks something like this:

QObject *oid;
unsigned long id;

oid = qlist_pop(list);
id = qnum_get_uint(qobject_to_qnum(oid));

Since objects in the list are QObject type.

Yuval

> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> Reviewed-by: Alberto Garcia <berto@igalia.com>
> Message-Id: <20180224154033.29559-5-mreitz@redhat.com>
> Reviewed-by: Eric Blake <eblake@redhat.com>
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
>  include/qapi/qmp/qbool.h   |  1 -
>  include/qapi/qmp/qdict.h   |  1 -
>  include/qapi/qmp/qlist.h   |  1 -
>  include/qapi/qmp/qnum.h    |  1 -
>  include/qapi/qmp/qstring.h |  1 -
>  qobject/qbool.c            | 11 -----------
>  qobject/qdict.c            | 11 -----------
>  qobject/qlist.c            | 11 -----------
>  qobject/qnum.c             | 11 -----------
>  qobject/qstring.c          | 11 -----------
>  10 files changed, 60 deletions(-)
> 
> diff --git a/include/qapi/qmp/qbool.h b/include/qapi/qmp/qbool.h
> index 629c508d34f..b9a44a1bfe0 100644
> --- a/include/qapi/qmp/qbool.h
> +++ b/include/qapi/qmp/qbool.h
> @@ -23,7 +23,6 @@ struct QBool {
> 
>  QBool *qbool_from_bool(bool value);
>  bool qbool_get_bool(const QBool *qb);
> -QBool *qobject_to_qbool(const QObject *obj);
>  bool qbool_is_equal(const QObject *x, const QObject *y);
>  void qbool_destroy_obj(QObject *obj);
> 
> diff --git a/include/qapi/qmp/qdict.h b/include/qapi/qmp/qdict.h
> index 7c6d8445495..2cc3e906f7b 100644
> --- a/include/qapi/qmp/qdict.h
> +++ b/include/qapi/qmp/qdict.h
> @@ -39,7 +39,6 @@ void qdict_put_obj(QDict *qdict, const char *key, QObject *value);
>  void qdict_del(QDict *qdict, const char *key);
>  int qdict_haskey(const QDict *qdict, const char *key);
>  QObject *qdict_get(const QDict *qdict, const char *key);
> -QDict *qobject_to_qdict(const QObject *obj);
>  bool qdict_is_equal(const QObject *x, const QObject *y);
>  void qdict_iter(const QDict *qdict,
>                  void (*iter)(const char *key, QObject *obj, void *opaque),
> diff --git a/include/qapi/qmp/qlist.h b/include/qapi/qmp/qlist.h
> index 5fd976a3981..5c673acb060 100644
> --- a/include/qapi/qmp/qlist.h
> +++ b/include/qapi/qmp/qlist.h
> @@ -53,7 +53,6 @@ QObject *qlist_pop(QList *qlist);
>  QObject *qlist_peek(QList *qlist);
>  int qlist_empty(const QList *qlist);
>  size_t qlist_size(const QList *qlist);
> -QList *qobject_to_qlist(const QObject *obj);
>  bool qlist_is_equal(const QObject *x, const QObject *y);
>  void qlist_destroy_obj(QObject *obj);
> 
> diff --git a/include/qapi/qmp/qnum.h b/include/qapi/qmp/qnum.h
> index 15e3971c7f1..3e47475b2cb 100644
> --- a/include/qapi/qmp/qnum.h
> +++ b/include/qapi/qmp/qnum.h
> @@ -68,7 +68,6 @@ double qnum_get_double(QNum *qn);
> 
>  char *qnum_to_string(QNum *qn);
> 
> -QNum *qobject_to_qnum(const QObject *obj);
>  bool qnum_is_equal(const QObject *x, const QObject *y);
>  void qnum_destroy_obj(QObject *obj);
> 
> diff --git a/include/qapi/qmp/qstring.h b/include/qapi/qmp/qstring.h
> index 98070ef3d6a..b72843fc1b0 100644
> --- a/include/qapi/qmp/qstring.h
> +++ b/include/qapi/qmp/qstring.h
> @@ -30,7 +30,6 @@ const char *qstring_get_str(const QString *qstring);
>  void qstring_append_int(QString *qstring, int64_t value);
>  void qstring_append(QString *qstring, const char *str);
>  void qstring_append_chr(QString *qstring, int c);
> -QString *qobject_to_qstring(const QObject *obj);
>  bool qstring_is_equal(const QObject *x, const QObject *y);
>  void qstring_destroy_obj(QObject *obj);
> 
> diff --git a/qobject/qbool.c b/qobject/qbool.c
> index 5be6277cca8..b58249925c2 100644
> --- a/qobject/qbool.c
> +++ b/qobject/qbool.c
> @@ -39,17 +39,6 @@ bool qbool_get_bool(const QBool *qb)
>      return qb->value;
>  }
> 
> -/**
> - * qobject_to_qbool(): Convert a QObject into a QBool
> - */
> -QBool *qobject_to_qbool(const QObject *obj)
> -{
> -    if (!obj || qobject_type(obj) != QTYPE_QBOOL) {
> -        return NULL;
> -    }
> -    return container_of(obj, QBool, base);
> -}
> -
>  /**
>   * qbool_is_equal(): Test whether the two QBools are equal
>   */
> diff --git a/qobject/qdict.c b/qobject/qdict.c
> index 1e588123d00..45c8b53361f 100644
> --- a/qobject/qdict.c
> +++ b/qobject/qdict.c
> @@ -37,17 +37,6 @@ QDict *qdict_new(void)
>      return qdict;
>  }
> 
> -/**
> - * qobject_to_qdict(): Convert a QObject into a QDict
> - */
> -QDict *qobject_to_qdict(const QObject *obj)
> -{
> -    if (!obj || qobject_type(obj) != QTYPE_QDICT) {
> -        return NULL;
> -    }
> -    return container_of(obj, QDict, base);
> -}
> -
>  /**
>   * tdb_hash(): based on the hash agorithm from gdbm, via tdb
>   * (from module-init-tools)
> diff --git a/qobject/qlist.c b/qobject/qlist.c
> index 77f19ffda78..954fe983751 100644
> --- a/qobject/qlist.c
> +++ b/qobject/qlist.c
> @@ -151,17 +151,6 @@ size_t qlist_size(const QList *qlist)
>      return count;
>  }
> 
> -/**
> - * qobject_to_qlist(): Convert a QObject into a QList
> - */
> -QList *qobject_to_qlist(const QObject *obj)
> -{
> -    if (!obj || qobject_type(obj) != QTYPE_QLIST) {
> -        return NULL;
> -    }
> -    return container_of(obj, QList, base);
> -}
> -
>  /**
>   * qlist_is_equal(): Test whether the two QLists are equal
>   *
> diff --git a/qobject/qnum.c b/qobject/qnum.c
> index ea091cfaa4b..1501c828323 100644
> --- a/qobject/qnum.c
> +++ b/qobject/qnum.c
> @@ -199,17 +199,6 @@ char *qnum_to_string(QNum *qn)
>      return NULL;
>  }
> 
> -/**
> - * qobject_to_qnum(): Convert a QObject into a QNum
> - */
> -QNum *qobject_to_qnum(const QObject *obj)
> -{
> -    if (!obj || qobject_type(obj) != QTYPE_QNUM) {
> -        return NULL;
> -    }
> -    return container_of(obj, QNum, base);
> -}
> -
>  /**
>   * qnum_is_equal(): Test whether the two QNums are equal
>   *
> diff --git a/qobject/qstring.c b/qobject/qstring.c
> index 2b2153206df..8bae529ef79 100644
> --- a/qobject/qstring.c
> +++ b/qobject/qstring.c
> @@ -105,17 +105,6 @@ void qstring_append_chr(QString *qstring, int c)
>      qstring->string[qstring->length] = 0;
>  }
> 
> -/**
> - * qobject_to_qstring(): Convert a QObject to a QString
> - */
> -QString *qobject_to_qstring(const QObject *obj)
> -{
> -    if (!obj || qobject_type(obj) != QTYPE_QSTRING) {
> -        return NULL;
> -    }
> -    return container_of(obj, QString, base);
> -}
> -
>  /**
>   * qstring_get_str(): Return a pointer to the stored string
>   *

  reply	other threads:[~2018-04-12 17:52 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-12 18:35 [Qemu-devel] [PULL 00/36] QAPI patches for 2018-03-12, 2.12 softfreeze Eric Blake
2018-03-12 18:35 ` [Qemu-devel] [PULL 01/36] qapi2texi: minor python code simplification Eric Blake
2018-03-12 18:35 ` [Qemu-devel] [PULL 02/36] qlit: use QType instead of int Eric Blake
2018-03-12 18:35 ` [Qemu-devel] [PULL 03/36] qlit: add qobject_from_qlit() Eric Blake
2018-03-12 18:35 ` [Qemu-devel] [PULL 04/36] qapi: generate a literal qobject for introspection Eric Blake
2018-03-12 18:35 ` [Qemu-devel] [PULL 05/36] compiler: Add QEMU_BUILD_BUG_MSG() macro Eric Blake
2018-03-12 18:35 ` [Qemu-devel] [PULL 06/36] qapi: Add qobject_to() Eric Blake
2018-03-12 18:35 ` [Qemu-devel] [PULL 07/36] qapi: Replace qobject_to_X(o) by qobject_to(X, o) Eric Blake
2018-03-12 18:35 ` [Qemu-devel] [PULL 08/36] qapi: Remove qobject_to_X() functions Eric Blake
2018-04-12 17:51   ` Yuval Shaia [this message]
2018-04-12 20:52     ` [Qemu-devel] [PULL, " Eric Blake
2018-04-13 11:33       ` Yuval Shaia
2018-03-12 18:36 ` [Qemu-devel] [PULL 09/36] qapi: Make more of qobject_to() Eric Blake
2018-03-12 18:36 ` [Qemu-devel] [PULL 10/36] block: Handle null backing link Eric Blake
2018-03-12 18:36 ` [Qemu-devel] [PULL 11/36] block: Deprecate "backing": "" Eric Blake
2018-03-12 18:36 ` [Qemu-devel] [PULL 12/36] docs: update QMP documents for OOB commands Eric Blake
2018-03-12 18:36 ` [Qemu-devel] [PULL 13/36] qobject: introduce qstring_get_try_str() Eric Blake
2018-03-12 18:36 ` [Qemu-devel] [PULL 14/36] qobject: introduce qobject_get_try_str() Eric Blake
2018-03-12 18:36 ` [Qemu-devel] [PULL 15/36] qobject: let object_property_get_str() use new API Eric Blake
2018-03-12 18:36 ` [Qemu-devel] [PULL 16/36] monitor: move skip_flush into monitor_data_init Eric Blake
2018-03-12 18:36 ` [Qemu-devel] [PULL 17/36] monitor: move the cur_mon hack deeper for QMP Eric Blake
2018-03-12 18:36 ` [Qemu-devel] [PULL 18/36] monitor: unify global init Eric Blake
2018-03-12 18:36 ` [Qemu-devel] [PULL 19/36] monitor: let mon_list be tail queue Eric Blake
2018-03-12 18:36 ` [Qemu-devel] [PULL 20/36] monitor: allow using IO thread for parsing Eric Blake
2018-03-12 18:36 ` [Qemu-devel] [PULL 21/36] qmp: introduce QMPCapability Eric Blake
2018-03-12 18:36 ` [Qemu-devel] [PULL 22/36] monitor: introduce monitor_qmp_respond() Eric Blake
2018-03-12 18:36 ` [Qemu-devel] [PULL 23/36] monitor: let suspend_cnt be thread safe Eric Blake
2018-03-12 18:36 ` [Qemu-devel] [PULL 24/36] monitor: let suspend/resume work even with QMPs Eric Blake
2018-03-12 18:36 ` [Qemu-devel] [PULL 25/36] monitor: separate QMP parser and dispatcher Eric Blake
2018-03-12 18:36 ` [Qemu-devel] [PULL 26/36] qmp: add new event "command-dropped" Eric Blake
2018-03-12 18:36 ` [Qemu-devel] [PULL 27/36] monitor: send event when command queue full Eric Blake
2018-03-12 18:36 ` [Qemu-devel] [PULL 28/36] qapi: introduce new cmd option "allow-oob" Eric Blake
2018-03-12 18:36 ` [Qemu-devel] [PULL 29/36] qmp: support out-of-band (oob) execution Eric Blake
2018-03-12 18:36 ` [Qemu-devel] [PULL 30/36] qmp: isolate responses into io thread Eric Blake
2018-03-12 18:36 ` [Qemu-devel] [PULL 31/36] monitor: enable IO thread for (qmp & !mux) typed Eric Blake
2018-03-21 12:37   ` Max Reitz
2018-03-21 12:41     ` Max Reitz
2018-03-21 17:11     ` Eric Blake
2018-03-21 17:15       ` Dr. David Alan Gilbert
2018-03-22  3:09       ` Peter Xu
2018-03-12 18:36 ` [Qemu-devel] [PULL 32/36] qmp: add command "x-oob-test" Eric Blake
2018-03-12 18:36 ` [Qemu-devel] [PULL 33/36] tests: qmp-test: verify command batching Eric Blake
2018-03-12 18:36 ` [Qemu-devel] [PULL 34/36] tests: qmp-test: add oob test Eric Blake
2018-03-12 18:36 ` [Qemu-devel] [PULL 35/36] block/accounting: introduce latency histogram Eric Blake
2018-03-12 18:36 ` [Qemu-devel] [PULL 36/36] qapi: add block latency histogram interface Eric Blake
2018-03-13 14:02 ` [Qemu-devel] [PULL 00/36] QAPI patches for 2018-03-12, 2.12 softfreeze Peter Maydell
2018-03-13 14:17   ` Eric Blake
2018-03-13 15:21     ` Peter Xu
2018-03-13 21:55     ` Eric Blake
2018-03-14 12:31       ` Peter Maydell

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=20180412175140.GA5406@yuvallap \
    --to=yuval.shaia@oracle.com \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=marcel@redhat.com \
    --cc=mreitz@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).