On Tue, Jan 09, 2018 at 04:50:39PM -0600, Eric Blake wrote: > On 12/19/2017 02:45 AM, Peter Xu wrote: > > A quick way to fetch string from qobject when it's a QString. > > > > Reviewed-by: Fam Zheng <f...@redhat.com> > > Reviewed-by: Stefan Hajnoczi <stefa...@redhat.com> > > Signed-off-by: Peter Xu <pet...@redhat.com> > > --- > > include/qapi/qmp/qstring.h | 1 + > > qobject/qstring.c | 11 +++++++++++ > > 2 files changed, 12 insertions(+) > > > > diff --git a/include/qapi/qmp/qstring.h b/include/qapi/qmp/qstring.h > > index a145c8ca00..6517d8e377 100644 > > --- a/include/qapi/qmp/qstring.h > > +++ b/include/qapi/qmp/qstring.h > > @@ -28,6 +28,7 @@ QString *qstring_from_substr(const char *str, int start, > > int end); > > size_t qstring_get_length(const QString *qstring); > > const char *qstring_get_str(const QString *qstring); > > const char *qstring_get_try_str(const QString *qstring); > > +const char *qobject_get_try_str(const QObject *qstring); > > The naming is consistent, so I won't reject the patch, but 'try_get_str' > reads better than 'get_try_str'. Of course, fixing the code base to > read well AND be consistent is a much bigger task, and I'm not asking > you to tackle it.
I agree. > > > > > > +/** > > + * qobject_get_try_str(): Return a pointer of the backstore string > > The word "backstore" doesn't appear anywhere in qemu.git, and flags as a > typo. I'd prefer: > > Return a pointer to the corresponding string I'll take this one. Thanks, > > or maybe "backing string" -- Peter Xu