The following commit has been merged in the master branch:
commit 8c234c5698645a759f6153fd1be4d7b90059bb88
Author: Guillem Jover <[email protected]>
Date:   Sun Oct 24 03:28:55 2010 +0200

    libdpkg: Move namevalue declarations to its own header file

diff --git a/lib/dpkg/Makefile.am b/lib/dpkg/Makefile.am
index c366251..1604549 100644
--- a/lib/dpkg/Makefile.am
+++ b/lib/dpkg/Makefile.am
@@ -74,6 +74,7 @@ pkginclude_HEADERS = \
        glob.h \
        macros.h \
        myopt.h \
+       namevalue.h \
        parsedump.h \
        path.h \
        pkg.h \
diff --git a/lib/dpkg/dpkg-db.h b/lib/dpkg/dpkg-db.h
index cd4bc53..d54d93b 100644
--- a/lib/dpkg/dpkg-db.h
+++ b/lib/dpkg/dpkg-db.h
@@ -251,10 +251,7 @@ void copy_dependency_links(struct pkginfo *pkg,
 
 /*** from parsehelp.c ***/
 
-struct namevalue {
-  const char *name;
-  int value, length;
-};
+#include <dpkg/namevalue.h>
 
 extern const struct namevalue booleaninfos[];
 extern const struct namevalue priorityinfos[];
diff --git a/lib/dpkg/test/t-macros.c b/lib/dpkg/namevalue.h
similarity index 66%
copy from lib/dpkg/test/t-macros.c
copy to lib/dpkg/namevalue.h
index 1616a9e..a512a4e 100644
--- a/lib/dpkg/test/t-macros.c
+++ b/lib/dpkg/namevalue.h
@@ -1,7 +1,8 @@
 /*
  * libdpkg - Debian packaging suite library routines
- * t-macros.c - test C support macros
+ * namevalue.h - name value structure handling
  *
+ * Copyright © 1994,1995 Ian Jackson <[email protected]>
  * Copyright © 2009 Guillem Jover <[email protected]>
  *
  * This is free software; you can redistribute it and/or modify
@@ -18,23 +19,22 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <config.h>
-#include <compat.h>
+#ifndef LIBDPKG_NAMEVALUE_H
+#define LIBDPKG_NAMEVALUE_H
 
-#include <dpkg/test.h>
 #include <dpkg/macros.h>
 
-static void
-test(void)
-{
-       test_pass(min(10, 30) == 10);
-       test_pass(min(30, 10) == 10);
-       test_pass(min(0, 10) == 0);
-       test_pass(min(-10, 0) == -10);
+DPKG_BEGIN_DECLS
 
-       test_pass(max(10, 30) == 30);
-       test_pass(max(30, 10) == 30);
-       test_pass(max(0, 10) == 10);
-       test_pass(max(-10, 0) == 0);
-}
+struct namevalue {
+       const char *name;
+       int value;
+       int length;
+};
 
+#define NAMEVALUE_DEF(n, v) \
+       [v] = { .name = n, .value = v, .length = sizeof(n) - 1 }
+
+DPKG_END_DECLS
+
+#endif /* LIBDPKG_NAMEVALUE_H */
diff --git a/lib/dpkg/parsehelp.c b/lib/dpkg/parsehelp.c
index ded2f5e..853a25d 100644
--- a/lib/dpkg/parsehelp.c
+++ b/lib/dpkg/parsehelp.c
@@ -80,9 +80,6 @@ parse_warn(struct parsedb_state *ps,
   va_end(args);
 }
 
-#define NAMEVALUE_DEF(n, v) \
-       [v] = { .name = n, .value = v, .length = sizeof(n) - 1 }
-
 const struct namevalue booleaninfos[] = {
   NAMEVALUE_DEF("no",  false),
   NAMEVALUE_DEF("yes", true),

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to