2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

uuid: Change semantics of uuid_is_partial_string().

Until now, uuid_is_partial_string() returned the number of characters at
the beginning of a string that were the beginning of a valid UUID.  This
is useful, but all of the callers actually wanted to get a value of 0 if
the string contained a character that was invalid for a UUID.  This makes
that change.

Examples:

  "123" previously yielded 3 and still does.
  "xyzzy" previously yielded 0 and still does.
  "123xyzzy" previously yielded 3, now yields 0.
  "e66250bb-9531-491b-b9c3-5385cabb0080" previously yielded 36, still does.
  "e66250bb-9531-491b-b9c3-5385cabb0080xyzzy" previously yielded 36, now 0.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
This commit is contained in:
Ben Pfaff
2017-04-30 14:09:55 -07:00
parent 044bbae72d
commit 2052f3a1d6
3 changed files with 24 additions and 14 deletions

View File

@@ -338,9 +338,7 @@ get_row(struct ctl_context *ctx,
}
}
}
if (!row
&& record_id[uuid_is_partial_string(record_id)] == '\0'
&& strlen(record_id) >= 4) {
if (!row && uuid_is_partial_string(record_id) >= 4) {
for (const struct ovsdb_idl_row *r = ovsdb_idl_first_row(ctx->idl,
table);
r != NULL;