Explorar o código

Use new EMPTYHASHFLAG instead of EMPTY_HASH or literal string

Guillem Jover %!s(int64=14) %!d(string=hai) anos
pai
achega
0fe9406130
Modificáronse 2 ficheiros con 4 adicións e 3 borrados
  1. 2 0
      lib/dpkg/dpkg.h
  2. 2 3
      src/configure.c

+ 2 - 0
lib/dpkg/dpkg.h

@@ -4,6 +4,7 @@
  *
  * Copyright © 1994,1995 Ian Jackson <ian@chiark.greenend.org.uk>
  * Copyright © 2000,2001 Wichert Akkerman <wichert@debian.org>
+ * Copyright © 2006-2012 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
@@ -42,6 +43,7 @@ DPKG_BEGIN_DECLS
 
 #define NEWCONFFILEFLAG    "newconffile"
 #define NONEXISTENTFLAG    "nonexistent"
+#define EMPTYHASHFLAG      "-"
 
 #define DPKGTEMPEXT        ".dpkg-tmp"
 #define DPKGNEWEXT         ".dpkg-new"

+ 2 - 3
src/configure.c

@@ -72,7 +72,6 @@ static void
 deferred_configure_conffile(struct pkginfo *pkg, struct conffile *conff)
 {
 	struct filenamenode *usenode;
-	static const char EMPTY_HASH[] = "-";
 	char currenthash[MD5HASHLEN + 1], newdisthash[MD5HASHLEN + 1];
 	int useredited, distedited;
 	enum conffopt what;
@@ -86,7 +85,7 @@ deferred_configure_conffile(struct pkginfo *pkg, struct conffile *conff)
 
 	r = conffderef(pkg, &cdr, usenode->name);
 	if (r == -1) {
-		conff->hash = EMPTY_HASH;
+		conff->hash = EMPTYHASHFLAG;
 		return;
 	}
 	md5hash(pkg, currenthash, cdr.buf);
@@ -505,7 +504,7 @@ md5hash(struct pkginfo *pkg, char *hashbuf, const char *fn)
 	} else {
 		warning(_("%s: unable to open conffile %s for hash: %s"),
 		        pkg_name(pkg, pnaw_nonambig), fn, strerror(errno));
-		strcpy(hashbuf, "-");
+		strcpy(hashbuf, EMPTYHASHFLAG);
 	}
 }