qstring: add qstring_get_length()

Long overdue.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
Luiz Capitulino 2013-03-25 13:46:37 -04:00
parent d05ef16045
commit 54d49ac992
2 changed files with 9 additions and 0 deletions

View File

@ -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);

View File

@ -31,6 +31,14 @@ QString *qstring_new(void)
return qstring_from_str("");
}
/**
* 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
*