diff options
author | Markus Armbruster <armbru@redhat.com> | 2018-07-27 08:22:04 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2018-07-28 09:09:58 +0200 |
commit | ba891d68b4ff17faaea3d3a8bfd82af3eed0a134 (patch) | |
tree | a60591188270f2ec5ade8eef780b26da5ddf0efd /tests | |
parent | b65ab77b3afadd7bb3051b341a5258ff7fb9d246 (diff) |
qstring: Move qstring_from_substr()'s @end one to the right
qstring_from_substr() takes the index of the substring's first and
last character. qstring_from_substr(s, 0, SIZE_MAX) denotes an empty
substring. Awkward.
Shift the end index one to the right. This simplifies both
qstring_from_substr() and its callers.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20180727062204.10401-3-armbru@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/check-qobject.c | 2 | ||||
-rw-r--r-- | tests/check-qstring.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/tests/check-qobject.c b/tests/check-qobject.c index 16ccbde82c..593c3a0618 100644 --- a/tests/check-qobject.c +++ b/tests/check-qobject.c @@ -154,7 +154,7 @@ static void qobject_is_equal_string_test(void) str_case = qstring_from_str("Foo"); /* Should yield "foo" */ - str_built = qstring_from_substr("form", 0, 1); + str_built = qstring_from_substr("form", 0, 2); qstring_append_chr(str_built, 'o'); check_unequal(str_base, str_whitespace_0, str_whitespace_1, diff --git a/tests/check-qstring.c b/tests/check-qstring.c index f11a7a8605..2d079921e3 100644 --- a/tests/check-qstring.c +++ b/tests/check-qstring.c @@ -66,7 +66,7 @@ static void qstring_from_substr_test(void) { QString *qs; - qs = qstring_from_substr("virtualization", 3, 9); + qs = qstring_from_substr("virtualization", 3, 10); g_assert(qs != NULL); g_assert(strcmp(qstring_get_str(qs), "tualiza") == 0); |