diff mbox series

[ovs-dev,v2,2/4] ovsdb: Simplify UUID formatting code.

Message ID 20240625081157.643558-2-whitecrowbar@gmail.com
State Superseded
Headers show
Series [ovs-dev,v2,1/4] .gitignore: Add clangd configuration file. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Grigorii Nazarov June 25, 2024, 8:11 a.m. UTC
Signed-off-by: Grigorii Nazarov <whitecrowbar@gmail.com>
---
 lib/ovsdb-data.c | 8 +-------
 lib/uuid.h       | 1 +
 2 files changed, 2 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/lib/ovsdb-data.c b/lib/ovsdb-data.c
index abb923ad8..defb048d7 100644
--- a/lib/ovsdb-data.c
+++ b/lib/ovsdb-data.c
@@ -2582,14 +2582,8 @@  char *
 ovsdb_data_row_name(const struct uuid *uuid)
 {
     char *name;
-    char *p;
 
-    name = xasprintf("row"UUID_FMT, UUID_ARGS(uuid));
-    for (p = name; *p != '\0'; p++) {
-        if (*p == '-') {
-            *p = '_';
-        }
-    }
+    name = xasprintf(UUID_ROW_FMT, UUID_ARGS(uuid));
 
     return name;
 }
diff --git a/lib/uuid.h b/lib/uuid.h
index fa49354f6..6a8069f68 100644
--- a/lib/uuid.h
+++ b/lib/uuid.h
@@ -34,6 +34,7 @@  extern "C" {
  */
 #define UUID_LEN 36
 #define UUID_FMT "%08x-%04x-%04x-%04x-%04x%08x"
+#define UUID_ROW_FMT "row%08x_%04x_%04x_%04x_%04x%08x"
 #define UUID_ARGS(UUID)                             \
     ((unsigned int) ((UUID)->parts[0])),            \
     ((unsigned int) ((UUID)->parts[1] >> 16)),      \