Pārlūkot izejas kodu

libdpkg: Split dpkg-priv.h into smaller pieces

Make the dependencies on other modules explicit, and avoid clutter by
not including unneeded stuff.
Guillem Jover 17 gadi atpakaļ
vecāks
revīzija
605162178f

+ 1 - 1
dpkg-deb/build.c

@@ -45,7 +45,7 @@
 
 #include <dpkg/dpkg.h>
 #include <dpkg/dpkg-db.h>
-#include <dpkg/dpkg-priv.h>
+#include <dpkg/path.h>
 #include <dpkg/myopt.h>
 
 #include "dpkg-deb.h"

+ 1 - 1
dselect/method.cc

@@ -44,7 +44,7 @@
 
 #include <dpkg/dpkg.h>
 #include <dpkg/dpkg-db.h>
-#include <dpkg/dpkg-priv.h>
+#include <dpkg/subproc.h>
 
 #include "dselect.h"
 #include "method.h"

+ 3 - 4
lib/dpkg/Makefile.am

@@ -18,7 +18,6 @@ noinst_LIBRARIES = libdpkg.a
 libdpkg_a_SOURCES = \
 	dpkg.h \
 	dpkg-db.h \
-	dpkg-priv.h \
 	dpkg-test.h \
 	dlist.h \
 	cleanup.c \
@@ -40,11 +39,11 @@ libdpkg_a_SOURCES = \
 	parse.c \
 	parsehelp.c \
 	parsedump.h \
-	path.c \
+	path.c path.h \
 	progress.c progress.h \
 	showpkg.c \
-	string.c \
-	subproc.c \
+	string.c string.h \
+	subproc.c subproc.h \
 	tarfn.c tarfn.h \
 	triglib.c \
 	trigdeferred.l \

+ 1 - 1
lib/dpkg/fields.c

@@ -30,7 +30,7 @@
 
 #include <dpkg/dpkg.h>
 #include <dpkg/dpkg-db.h>
-#include <dpkg/dpkg-priv.h>
+#include <dpkg/path.h>
 #include <dpkg/parsedump.h>
 
 static int

+ 1 - 1
lib/dpkg/parsehelp.c

@@ -30,7 +30,7 @@
 
 #include <dpkg/dpkg.h>
 #include <dpkg/dpkg-db.h>
-#include <dpkg/dpkg-priv.h>
+#include <dpkg/string.h>
 #include <dpkg/parsedump.h>
 
 static void

+ 1 - 1
lib/dpkg/path.c

@@ -25,7 +25,7 @@
 
 #include <string.h>
 
-#include <dpkg/dpkg-priv.h>
+#include <dpkg/path.h>
 
 size_t
 path_rtrim_slash_slashdot(char *path)

+ 5 - 16
lib/dpkg/dpkg-priv.h

@@ -1,6 +1,6 @@
 /*
  * libdpkg - Debian packaging suite library routines
- * dpkg-priv.h - private declarations for libdpkg and dpkg programs
+ * path.h - path handling routines
  *
  * Copyright © 2008 Guillem Jover <guillem@debian.org>
  *
@@ -19,32 +19,21 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#ifndef DPKG_PRIV_H
-#define DPKG_PRIV_H
+#ifndef DPKG_PATH_H
+#define DPKG_PATH_H
 
 #include <dpkg/macros.h>
 
-DPKG_BEGIN_DECLS
-
 #ifdef HAVE_STDDEF_H
 #include <stddef.h>
 #endif
 
-/* String handling. */
-
-char *str_escape_fmt(char *dest, const char *src);
-
-/* Path handling. */
+DPKG_BEGIN_DECLS
 
 size_t path_rtrim_slash_slashdot(char *path);
 const char *path_skip_slash_dotslash(const char *path);
 
-/* Subprocess handling. */
-
-void setup_subproc_signals(const char *name);
-void cu_subproc_signals(int argc, void **argv);
-
 DPKG_END_DECLS
 
-#endif /* DPKG_PRIV_H */
+#endif /* DPKG_PATH_H */
 

+ 1 - 1
lib/dpkg/string.c

@@ -23,7 +23,7 @@
 #include <config.h>
 #include <compat.h>
 
-#include <dpkg/dpkg-priv.h>
+#include <dpkg/string.h>
 
 char *
 str_escape_fmt(char *dst, const char *src)

+ 34 - 0
lib/dpkg/string.h

@@ -0,0 +1,34 @@
+/*
+ * libdpkg - Debian packaging suite library routines
+ * string.h - string handling routines
+ *
+ * Copyright © 2008 Guillem Jover <guillem@debian.org>
+ *
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2,
+ * or (at your option) any later version.
+ *
+ * This is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with dpkg; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef DPKG_STRING_H
+#define DPKG_STRING_H
+
+#include <dpkg/macros.h>
+
+DPKG_BEGIN_DECLS
+
+char *str_escape_fmt(char *dest, const char *src);
+
+DPKG_END_DECLS
+
+#endif /* DPKG_STRING_H */
+

+ 1 - 1
lib/dpkg/subproc.c

@@ -32,7 +32,7 @@
 #include <signal.h>
 
 #include <dpkg/dpkg.h>
-#include <dpkg/dpkg-priv.h>
+#include <dpkg/subproc.h>
 
 static int catch_signals[] = { SIGQUIT, SIGINT };
 static struct sigaction uncatch_signals[sizeof_array(catch_signals)];

+ 35 - 0
lib/dpkg/subproc.h

@@ -0,0 +1,35 @@
+/*
+ * libdpkg - Debian packaging suite library routines
+ * subproc.h - sub-process handling routines
+ *
+ * Copyright © 2008 Guillem Jover <guillem@debian.org>
+ *
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2,
+ * or (at your option) any later version.
+ *
+ * This is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with dpkg; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef DPKG_SUBPROC_H
+#define DPKG_SUBPROC_H
+
+#include <dpkg/macros.h>
+
+DPKG_BEGIN_DECLS
+
+void setup_subproc_signals(const char *name);
+void cu_subproc_signals(int argc, void **argv);
+
+DPKG_END_DECLS
+
+#endif /* DPKG_SUBPROC_H */
+

+ 1 - 1
lib/dpkg/test/t-path.c

@@ -20,7 +20,7 @@
  */
 
 #include <dpkg/test.h>
-#include <dpkg/dpkg-priv.h>
+#include <dpkg/path.h>
 
 #include <stdlib.h>
 

+ 1 - 1
lib/dpkg/test/t-string.c

@@ -20,7 +20,7 @@
  */
 
 #include <dpkg/test.h>
-#include <dpkg/dpkg-priv.h>
+#include <dpkg/string.h>
 
 #include <string.h>
 

+ 1 - 1
src/filesdb.c

@@ -38,7 +38,7 @@
 
 #include <dpkg/dpkg.h>
 #include <dpkg/dpkg-db.h>
-#include <dpkg/dpkg-priv.h>
+#include <dpkg/path.h>
 #include <dpkg/progress.h>
 
 #include "filesdb.h"

+ 2 - 1
src/help.c

@@ -36,7 +36,8 @@
 
 #include <dpkg/dpkg.h>
 #include <dpkg/dpkg-db.h>
-#include <dpkg/dpkg-priv.h>
+#include <dpkg/path.h>
+#include <dpkg/subproc.h>
 
 #include "filesdb.h"
 #include "main.h"

+ 1 - 1
src/query.c

@@ -41,7 +41,7 @@
 
 #include <dpkg/dpkg.h>
 #include <dpkg/dpkg-db.h>
-#include <dpkg/dpkg-priv.h>
+#include <dpkg/path.h>
 #include <dpkg/myopt.h>
 
 #include "pkg-array.h"