Patchwork [1/2] qstring: add qobject_get_length()

login
register
mail settings
Submitter Luiz Capitulino
Date March 25, 2013, 7:40 p.m.
Message ID <1364240439-23450-2-git-send-email-lcapitulino@redhat.com>
Download mbox | patch
Permalink /patch/230981/
State New
Headers show

Comments

Luiz Capitulino - March 25, 2013, 7:40 p.m.
Long overdue.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 include/qapi/qmp/qstring.h | 1 +
 qobject/qstring.c          | 8 ++++++++
 2 files changed, 9 insertions(+)
Hu Tao - April 9, 2013, 3:02 a.m.
'add qobject_get_length()' in the subject line but you are actually
adding qstring_get_length()

On Mon, Mar 25, 2013 at 03:40:38PM -0400, Luiz Capitulino wrote:
> Long overdue.
> 
> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> ---
>  include/qapi/qmp/qstring.h | 1 +
>  qobject/qstring.c          | 8 ++++++++
>  2 files changed, 9 insertions(+)
> 
> diff --git a/include/qapi/qmp/qstring.h b/include/qapi/qmp/qstring.h
> index 0e690f4..1bc3666 100644
> --- a/include/qapi/qmp/qstring.h
> +++ b/include/qapi/qmp/qstring.h
> @@ -26,6 +26,7 @@ typedef struct QString {
>  QString *qstring_new(void);
>  QString *qstring_from_str(const char *str);
>  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);
>  void qstring_append_int(QString *qstring, int64_t value);
>  void qstring_append(QString *qstring, const char *str);
> diff --git a/qobject/qstring.c b/qobject/qstring.c
> index 5f7376c..607b7a1 100644
> --- a/qobject/qstring.c
> +++ b/qobject/qstring.c
> @@ -32,6 +32,14 @@ QString *qstring_new(void)
>  }
>  
>  /**
> + * qstring_get_length(): Get the length of a QString
> + */
> +size_t qstring_get_length(const QString *qstring)
> +{
> +    return qstring->length;
> +}
> +
> +/**
>   * qstring_from_substr(): Create a new QString from a C string substring
>   *
>   * Return string reference
> -- 
> 1.8.1.4
Luiz Capitulino - April 9, 2013, 12:38 p.m.
On Tue, 9 Apr 2013 11:02:15 +0800
Hu Tao <hutao@cn.fujitsu.com> wrote:

> 'add qobject_get_length()' in the subject line but you are actually
> adding qstring_get_length()

Thanks, but this was corrected in v2 and it's what got merged.

> 
> On Mon, Mar 25, 2013 at 03:40:38PM -0400, Luiz Capitulino wrote:
> > Long overdue.
> > 
> > Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> > ---
> >  include/qapi/qmp/qstring.h | 1 +
> >  qobject/qstring.c          | 8 ++++++++
> >  2 files changed, 9 insertions(+)
> > 
> > diff --git a/include/qapi/qmp/qstring.h b/include/qapi/qmp/qstring.h
> > index 0e690f4..1bc3666 100644
> > --- a/include/qapi/qmp/qstring.h
> > +++ b/include/qapi/qmp/qstring.h
> > @@ -26,6 +26,7 @@ typedef struct QString {
> >  QString *qstring_new(void);
> >  QString *qstring_from_str(const char *str);
> >  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);
> >  void qstring_append_int(QString *qstring, int64_t value);
> >  void qstring_append(QString *qstring, const char *str);
> > diff --git a/qobject/qstring.c b/qobject/qstring.c
> > index 5f7376c..607b7a1 100644
> > --- a/qobject/qstring.c
> > +++ b/qobject/qstring.c
> > @@ -32,6 +32,14 @@ QString *qstring_new(void)
> >  }
> >  
> >  /**
> > + * qstring_get_length(): Get the length of a QString
> > + */
> > +size_t qstring_get_length(const QString *qstring)
> > +{
> > +    return qstring->length;
> > +}
> > +
> > +/**
> >   * qstring_from_substr(): Create a new QString from a C string substring
> >   *
> >   * Return string reference
> > -- 
> > 1.8.1.4
>

Patch

diff --git a/include/qapi/qmp/qstring.h b/include/qapi/qmp/qstring.h
index 0e690f4..1bc3666 100644
--- a/include/qapi/qmp/qstring.h
+++ b/include/qapi/qmp/qstring.h
@@ -26,6 +26,7 @@  typedef struct QString {
 QString *qstring_new(void);
 QString *qstring_from_str(const char *str);
 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);
 void qstring_append_int(QString *qstring, int64_t value);
 void qstring_append(QString *qstring, const char *str);
diff --git a/qobject/qstring.c b/qobject/qstring.c
index 5f7376c..607b7a1 100644
--- a/qobject/qstring.c
+++ b/qobject/qstring.c
@@ -32,6 +32,14 @@  QString *qstring_new(void)
 }
 
 /**
+ * qstring_get_length(): Get the length of a QString
+ */
+size_t qstring_get_length(const QString *qstring)
+{
+    return qstring->length;
+}
+
+/**
  * qstring_from_substr(): Create a new QString from a C string substring
  *
  * Return string reference