summaryrefslogtreecommitdiff
path: root/lib/ofpbuf.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2016-02-10 15:54:43 -0800
committerBen Pfaff <blp@ovn.org>2016-02-19 00:02:16 -0800
commit27aa879386ce57929a0014835a344191bb89d24e (patch)
tree63b9153bf32a34002edc49cbaf0c15dc4dd7625e /lib/ofpbuf.c
parent29100ef2ba237a198b9cf85241107589af7b51d4 (diff)
downloadopenvswitch-27aa879386ce57929a0014835a344191bb89d24e.tar.gz
ofpbuf: Make ofpbuf_put_hex() accept period between hex bytes also.
This makes it accept the same syntax as parse_NOTE(), so that that function can be simplified. In an upcoming commit a second action will also be able to take advantage of the same feature. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
Diffstat (limited to 'lib/ofpbuf.c')
-rw-r--r--lib/ofpbuf.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/ofpbuf.c b/lib/ofpbuf.c
index c190f8bb6..a3c4da4bc 100644
--- a/lib/ofpbuf.c
+++ b/lib/ofpbuf.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2016 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -389,10 +389,10 @@ ofpbuf_put(struct ofpbuf *b, const void *p, size_t size)
return dst;
}
-/* Parses as many pairs of hex digits as possible (possibly separated by
- * spaces) from the beginning of 's', appending bytes for their values to 'b'.
- * Returns the first character of 's' that is not the first of a pair of hex
- * digits. If 'n' is nonnull, stores the number of bytes added to 'b' in
+/* Parses as many pairs of hex digits as possible (possibly separated by spaces
+ * or periods) from the beginning of 's', appending bytes for their values to
+ * 'b'. Returns the first character of 's' that is not the first of a pair of
+ * hex digits. If 'n' is nonnull, stores the number of bytes added to 'b' in
* '*n'. */
char *
ofpbuf_put_hex(struct ofpbuf *b, const char *s, size_t *n)
@@ -402,7 +402,7 @@ ofpbuf_put_hex(struct ofpbuf *b, const char *s, size_t *n)
uint8_t byte;
bool ok;
- s += strspn(s, " \t\r\n");
+ s += strspn(s, " .\t\r\n");
byte = hexits_value(s, 2, &ok);
if (!ok) {
if (n) {