diff mbox series

[ovs-dev,v4,1/3] ovsdb: Simplify UUID formatting code.

Message ID 20240701092609.1045115-2-whitecrowbar@gmail.com
State Superseded
Delegated to: Simon Horman
Headers show
Series [ovs-dev,v4,1/3] ovsdb: Simplify UUID formatting code. | expand

Commit Message

Grigorii Nazarov July 1, 2024, 9:25 a.m. UTC
Signed-off-by: Grigorii Nazarov <whitecrowbar@gmail.com>
---
v2: fixed title
v4: changed patch number from 2/4 to 1/3

 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)),      \