qobject: Drop qstring_get_try_str()
No users left outside tests/, and the ones in tests/ can just as well use qstring_get_str(). Do that, and drop the function. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20201211171152.146877-14-armbru@redhat.com>
This commit is contained in:
parent
808ac3657e
commit
b3119b0814
@ -28,7 +28,6 @@ QString *qstring_from_substr(const char *str, size_t start, size_t end);
|
|||||||
QString *qstring_from_gstring(GString *gstr);
|
QString *qstring_from_gstring(GString *gstr);
|
||||||
size_t qstring_get_length(const QString *qstring);
|
size_t qstring_get_length(const QString *qstring);
|
||||||
const char *qstring_get_str(const QString *qstring);
|
const char *qstring_get_str(const QString *qstring);
|
||||||
const char *qstring_get_try_str(const QString *qstring);
|
|
||||||
void qstring_append_int(QString *qstring, int64_t value);
|
void qstring_append_int(QString *qstring, int64_t value);
|
||||||
void qstring_append(QString *qstring, const char *str);
|
void qstring_append(QString *qstring, const char *str);
|
||||||
void qstring_append_chr(QString *qstring, int c);
|
void qstring_append_chr(QString *qstring, int c);
|
||||||
|
@ -139,16 +139,6 @@ const char *qstring_get_str(const QString *qstring)
|
|||||||
return qstring->string;
|
return qstring->string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* qstring_get_try_str(): Return a pointer to the stored string
|
|
||||||
*
|
|
||||||
* NOTE: will return NULL if qstring is not provided.
|
|
||||||
*/
|
|
||||||
const char *qstring_get_try_str(const QString *qstring)
|
|
||||||
{
|
|
||||||
return qstring ? qstring_get_str(qstring) : NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* qstring_is_equal(): Test whether the two QStrings are equal
|
* qstring_is_equal(): Test whether the two QStrings are equal
|
||||||
*/
|
*/
|
||||||
|
@ -89,7 +89,7 @@ static void escaped_string(void)
|
|||||||
for (j = 0; j < 2; j++) {
|
for (j = 0; j < 2; j++) {
|
||||||
if (test_cases[i].utf8_out) {
|
if (test_cases[i].utf8_out) {
|
||||||
cstr = from_json_str(test_cases[i].json_in, j, &error_abort);
|
cstr = from_json_str(test_cases[i].json_in, j, &error_abort);
|
||||||
g_assert_cmpstr(qstring_get_try_str(cstr),
|
g_assert_cmpstr(qstring_get_str(cstr),
|
||||||
==, test_cases[i].utf8_out);
|
==, test_cases[i].utf8_out);
|
||||||
if (!test_cases[i].skip) {
|
if (!test_cases[i].skip) {
|
||||||
jstr = to_json_str(cstr);
|
jstr = to_json_str(cstr);
|
||||||
@ -751,7 +751,7 @@ static void utf8_string(void)
|
|||||||
/* Parse @json_in, expect @utf8_out */
|
/* Parse @json_in, expect @utf8_out */
|
||||||
if (utf8_out) {
|
if (utf8_out) {
|
||||||
str = from_json_str(json_in, j, &error_abort);
|
str = from_json_str(json_in, j, &error_abort);
|
||||||
g_assert_cmpstr(qstring_get_try_str(str), ==, utf8_out);
|
g_assert_cmpstr(qstring_get_str(str), ==, utf8_out);
|
||||||
qobject_unref(str);
|
qobject_unref(str);
|
||||||
} else {
|
} else {
|
||||||
str = from_json_str(json_in, j, NULL);
|
str = from_json_str(json_in, j, NULL);
|
||||||
@ -782,7 +782,7 @@ static void utf8_string(void)
|
|||||||
/* Parse @json_out right back, unless it has replacements */
|
/* Parse @json_out right back, unless it has replacements */
|
||||||
if (!strstr(json_out, "\\uFFFD")) {
|
if (!strstr(json_out, "\\uFFFD")) {
|
||||||
str = from_json_str(json_out, j, &error_abort);
|
str = from_json_str(json_out, j, &error_abort);
|
||||||
g_assert_cmpstr(qstring_get_try_str(str), ==, utf8_in);
|
g_assert_cmpstr(qstring_get_str(str), ==, utf8_in);
|
||||||
qobject_unref(str);
|
qobject_unref(str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1021,9 +1021,8 @@ static void interpolation_valid(void)
|
|||||||
|
|
||||||
/* string */
|
/* string */
|
||||||
|
|
||||||
qstr = qobject_to(QString,
|
qstr = qobject_to(QString, qobject_from_jsonf_nofail("%s", value_s));
|
||||||
qobject_from_jsonf_nofail("%s", value_s));
|
g_assert_cmpstr(qstring_get_str(qstr), ==, value_s);
|
||||||
g_assert_cmpstr(qstring_get_try_str(qstr), ==, value_s);
|
|
||||||
qobject_unref(qstr);
|
qobject_unref(qstr);
|
||||||
|
|
||||||
/* object */
|
/* object */
|
||||||
|
Loading…
Reference in New Issue
Block a user