mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
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>
This commit is contained in:
parent
b65ab77b3a
commit
ba891d68b4
6 changed files with 8 additions and 8 deletions
|
@ -109,7 +109,7 @@ static int nbd_parse_uri(const char *filename, QDict *options)
|
|||
/* strip braces from literal IPv6 address */
|
||||
if (uri->server[0] == '[') {
|
||||
host = qstring_from_substr(uri->server, 1,
|
||||
strlen(uri->server) - 2);
|
||||
strlen(uri->server) - 1);
|
||||
} else {
|
||||
host = qstring_from_str(uri->server);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue