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

Change standard_startup and standard_shutdown into macros.

Adam Heath лет назад: 23
Родитель
Сommit
285c4bbec4
6 измененных файлов с 29 добавлено и 69 удалено
  1. 5 0
      ChangeLog
  2. 2 0
      debian/changelog
  3. 1 1
      debian/rules
  4. 20 2
      include/dpkg.h.in
  5. 1 1
      lib/Makefile.in
  6. 0 65
      lib/startup.c

+ 5 - 0
ChangeLog

@@ -1,3 +1,8 @@
+Sat Sep 13 14:31:22 CDT 2003 Adam Heath <doogie@debian.org>
+
+  * lib/startup.c, lib/Makefile.in, include/dpkg.h.in: Change
+    standard_startup and standard_shutdown into macros.
+
 Sat Sep 13 14:24:14 CDT 2003 Adam Heath <doogie@debian.org>
 
   * scripts/install-info.pl: Apply patch, to handle missing infodir.bak,

+ 2 - 0
debian/changelog

@@ -7,6 +7,8 @@ dpkg (1.10.11) unstable; urgency=low
   * Frank Lichtenheld <frank@lichtenheld.de>:
     Apply patch, to handle missing infodir.bak, and empty files.  Closes:
     #196361
+  * Change standard_startup and standard_shutdown into macros.  Closes:
+    #200351.
 
  -- Wichert Akkerman <debian@extern.wiggy.net>  UNRELEASED
 

+ 1 - 1
debian/rules

@@ -46,7 +46,7 @@ config.guess config.sub: %: /usr/share/misc/%
 $(BUILD)/configure-stamp: configure config.h.in config.guess config.sub
 	$(checkdir)
 	install -d $(@D)
-	cd $(@D) && LDFLAGS=$(LDFLAGS) $(CURDIR)/configure \
+	cd $(@D) && LDFLAGS=$(LDFLAGS) $(shell echo "$(patsubst $(CURDIR)/%,%,$(@D))" | sed -e 's,^[^/][^/]*$$,..,;s,/[^/][^/]*,/..,g' )/configure \
 		--prefix=/usr \
 		--datadir=/usr/share \
 		--mandir=/usr/share/man \

+ 20 - 2
include/dpkg.h.in

@@ -167,8 +167,26 @@ extern const char printforhelp[];
 
 /*** from startup.c ***/
 
-void standard_startup(jmp_buf *ejbuf, int argc, const char *const **argv, const char *prog, int loadcfg, const struct cmdinfo cmdinfos[]);
-void standard_shutdown(int freemem);
+#define standard_startup(ejbuf, argc, argv, prog, loadcfg, cmdinfos) do {\
+  setlocale(LC_ALL, "");\
+  bindtextdomain(PACKAGE, LOCALEDIR);\
+  textdomain(PACKAGE);\
+  if (setjmp(*ejbuf)) { /* expect warning about possible clobbering of argv */\
+    error_unwind(ehflag_bombout); exit(2);\
+  }\
+  push_error_handler(ejbuf,print_error_fatal,0);\
+  umask(022); /* Make sure all our status databases are readable. */\
+  if (loadcfg)\
+    loadcfgfile(prog, cmdinfos);\
+  myopt(argv,cmdinfos);\
+} while (0)
+
+#define standard_shutdown(freemem) do {\
+  set_error_display(0,0);\
+  error_unwind(ehflag_normaltidy);\
+  if (freemem)\
+    nffreeall();\
+} while (0)
 
 /*** from ehandle.c ***/
 

+ 1 - 1
lib/Makefile.in

@@ -9,7 +9,7 @@ include ../Makefile.conf
 SOURCES		= compat.c database.c dbmodify.c dump.c ehandle.c fields.c \
 		    lock.c mlib.c myopt.c nfmalloc.c parse.c parsehelp.c \
 		    showcright.c showpkg.c tarfn.c varbuf.c vercmp.c md5.c \
-		    utils.c startup.c
+		    utils.c
 
 OBJECTS		= $(patsubst %.c, %.o, $(SOURCES))
 GENFILES	= $(OBJECTS) libdpkg.a

+ 0 - 65
lib/startup.c

@@ -1,65 +0,0 @@
-/*
- * dpkg - main program for package management
- * main.c - main program
- *
- * Copyright (C) 1994,1995 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,
- * 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.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <errno.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <limits.h>
-#include <ctype.h>
-
-#include <config.h>
-#include <dpkg.h>
-#include <dpkg-db.h>
-#include <version.h>
-#include <myopt.h>
-
-void standard_startup(jmp_buf *ejbuf, int argc, const char *const **argv, const char *prog, int loadcfg, const struct cmdinfo cmdinfos[]) {
-
-  setlocale(LC_ALL, "");
-  bindtextdomain(PACKAGE, LOCALEDIR);
-  textdomain(PACKAGE);
-
-  if (setjmp(*ejbuf)) { /* expect warning about possible clobbering of argv */
-    error_unwind(ehflag_bombout); exit(2);
-  }
-  push_error_handler(ejbuf,print_error_fatal,0);
-
-  umask(022); /* Make sure all our status databases are readable. */
- 
-  if (loadcfg)
-    loadcfgfile(prog, cmdinfos);
-
-  myopt(argv,cmdinfos);
-}
-
-void standard_shutdown(int freemem) {
-  set_error_display(0,0);
-  error_unwind(ehflag_normaltidy);
-  if (freemem)
-    nffreeall();
-}