Welcome to little lamb

Code » limb » commit 0a71125

cdbmaker_sa: Small refactoring

author Olivier Brunel
2023-07-05 12:55:01 UTC
committer Olivier Brunel
2023-07-24 10:16:42 UTC
parent 784e0e1ad830bf3e76a01c7de2999e28b483a340

cdbmaker_sa: Small refactoring

src/include/cdbmake.h +13 -0
src/liblimb/cdbmake.h/cdbmaker_sa_add.c +1 -2
src/liblimb/cdbmake.h/cdbmaker_sa_finish.c +1 -2
src/liblimb/cdbmake.h/cdbmaker_sa_free.c +1 -2

diff --git a/src/include/cdbmake.h b/src/include/cdbmake.h
new file mode 100644
index 0000000..e57add7
--- /dev/null
+++ b/src/include/cdbmake.h
@@ -0,0 +1,13 @@
+/* This file is part of limb                           https://lila.oss/limb
+ * Copyright (C) 2023 Olivier Brunel                          jjk@jjacky.com */
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef LIMB_LIMB_CDBMAKE_H
+#define LIMB_LIMB_CDBMAKE_H
+
+struct diu32 {
+    u32 left;
+    u32 right;
+};
+typedef struct diu32 diu32;
+
+#endif /* LIMB_LIMB_CDBMAKE_H */
diff --git a/src/liblimb/cdbmake.h/cdbmaker_sa_add.c b/src/liblimb/cdbmake.h/cdbmaker_sa_add.c
index 1ae2f7f..cb3727b 100644
--- a/src/liblimb/cdbmake.h/cdbmaker_sa_add.c
+++ b/src/liblimb/cdbmake.h/cdbmaker_sa_add.c
@@ -4,12 +4,11 @@
 #include <errno.h>
 #include <limb/cdbmake.h>
 #include <limb/u32.h>
+#include "cdbmake.h"
 
 #include <limb/gccattributes.h>
 extern uint32_t cdb_hash (char const *, uint32_t) gccattr_pure ;
 
-#define diu32   diuint32
-
 #define cms_add(m,d,l)      stralloc_catb(&m->sa, d, l)
 
 static ssize_t
diff --git a/src/liblimb/cdbmake.h/cdbmaker_sa_finish.c b/src/liblimb/cdbmake.h/cdbmaker_sa_finish.c
index 84ca8a1..5137497 100644
--- a/src/liblimb/cdbmake.h/cdbmaker_sa_finish.c
+++ b/src/liblimb/cdbmake.h/cdbmaker_sa_finish.c
@@ -4,8 +4,7 @@
 #include <errno.h>
 #include <limb/cdbmake.h>
 #include <limb/u32.h>
-
-#define diu32   diuint32
+#include "cdbmake.h"
 
 int
 cdbmaker_sa_finish(cdbmaker_sa *m)
diff --git a/src/liblimb/cdbmake.h/cdbmaker_sa_free.c b/src/liblimb/cdbmake.h/cdbmaker_sa_free.c
index 4b278ec..6c974c4 100644
--- a/src/liblimb/cdbmake.h/cdbmaker_sa_free.c
+++ b/src/liblimb/cdbmake.h/cdbmaker_sa_free.c
@@ -2,8 +2,7 @@
  * Copyright (C) 2023 Olivier Brunel                          jjk@jjacky.com */
 /* SPDX-License-Identifier: GPL-2.0-only */
 #include <limb/cdbmake.h>
-
-#define diu32   diuint32
+#include "cdbmake.h"
 
 void
 cdbmaker_sa_free(cdbmaker_sa *m)