Просмотр исходного кода

libdpkg: Move trig_name_is_illegal to a new trigname module

This detangles the function from the triglib module, avoiding
dpkg-trigger to pull it, and reducing its size.
Guillem Jover лет назад: 15
Родитель
Сommit
2e9a20901a
5 измененных файлов с 46 добавлено и 16 удалено
  1. 2 0
      debian/changelog
  2. 1 0
      lib/dpkg/Makefile.am
  3. 0 16
      lib/dpkg/triglib.c
  4. 42 0
      lib/dpkg/trigname.c
  5. 1 0
      po/POTFILES.in

+ 2 - 0
debian/changelog

@@ -211,6 +211,8 @@ dpkg (1.16.1) UNRELEASED; urgency=low
     Closes: #639997
   * Do not warn on strange timestamps when unpacking with dpkg-deb.
     Closes: #639997
+  * Reduce dpkg-trigger binary size by refactoring libdpkg modules so that
+    it does not end up pulling triglib.
 
   [ Updated dpkg translations ]
   * German (Sven Joachim). Closes: #620312

+ 1 - 0
lib/dpkg/Makefile.am

@@ -62,6 +62,7 @@ libdpkg_a_SOURCES = \
 	subproc.c \
 	tarfn.c \
 	test.h \
+	trigname.c \
 	triglib.c \
 	trigdeferred.l \
 	utils.c \

+ 0 - 16
lib/dpkg/triglib.c

@@ -39,22 +39,6 @@
 #include <dpkg/trigdeferred.h>
 #include <dpkg/triglib.h>
 
-const char *
-trig_name_is_illegal(const char *p)
-{
-	int c;
-
-	if (!*p)
-		return _("empty trigger names are not permitted");
-
-	while ((c = *p++)) {
-		if (c <= ' ' || c >= 0177)
-			return _("trigger name contains invalid character");
-	}
-
-	return NULL;
-}
-
 /*========== Recording triggers. ==========*/
 
 static char *triggersdir, *triggersfilefile, *triggersnewfilefile;

+ 42 - 0
lib/dpkg/trigname.c

@@ -0,0 +1,42 @@
+/*
+ * libdpkg - Debian packaging suite library routines
+ * trigname.c - trigger name handling
+ *
+ * Copyright © 2007 Canonical Ltd
+ * Written by Ian Jackson <ian@chiark.greenend.org.uk>
+ *
+ * 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 of the License, 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+#include <compat.h>
+
+#include <dpkg/i18n.h>
+#include <dpkg/triglib.h>
+
+const char *
+trig_name_is_illegal(const char *p)
+{
+	int c;
+
+	if (!*p)
+		return _("empty trigger names are not permitted");
+
+	while ((c = *p++)) {
+		if (c <= ' ' || c >= 0177)
+			return _("trigger name contains invalid character");
+	}
+
+	return NULL;
+}

+ 1 - 0
po/POTFILES.in

@@ -33,6 +33,7 @@ lib/dpkg/subproc.c
 lib/dpkg/tarfn.c
 lib/dpkg/trigdeferred.l
 lib/dpkg/triglib.c
+lib/dpkg/trigname.c
 lib/dpkg/utils.c
 lib/dpkg/varbuf.c
 lib/dpkg/vercmp.c