Переглянути джерело

dpkg: Give more meaningful names to database stat variables

Name them as stab_prev and stab_next to denote the previous and next
database file to read.
Guillem Jover 12 роки тому
батько
коміт
c6194499b9
2 змінених файлів з 16 додано та 14 видалено
  1. 6 5
      src/divertdb.c
  2. 10 9
      src/statdb.c

+ 6 - 5
src/divertdb.c

@@ -47,7 +47,8 @@ static char *diversionsname;
 void
 ensure_diversions(void)
 {
-	struct stat stab1, stab2;
+	struct stat sb_prev;
+	struct stat sb_next;
 	char linebuf[MAXDIVERTFILENAME];
 	FILE *file;
 	struct diversion *ov, *oicontest, *oialtname;
@@ -66,12 +67,12 @@ ensure_diversions(void)
 			return;
 		}
 	} else if (diversionsfile) {
-		if (fstat(fileno(diversionsfile), &stab1))
+		if (fstat(fileno(diversionsfile), &sb_prev))
 			ohshite(_("failed to fstat previous diversions file"));
-		if (fstat(fileno(file), &stab2))
+		if (fstat(fileno(file), &sb_next))
 			ohshite(_("failed to fstat diversions file"));
-		if (stab1.st_dev == stab2.st_dev &&
-		    stab1.st_ino == stab2.st_ino) {
+		if (sb_prev.st_dev == sb_next.st_dev &&
+		    sb_prev.st_ino == sb_next.st_ino) {
 			fclose(file);
 			onerr_abort--;
 			return;

+ 10 - 9
src/statdb.c

@@ -111,7 +111,8 @@ statdb_parse_mode(const char *str)
 void
 ensure_statoverrides(void)
 {
-	struct stat stab1, stab2;
+	struct stat sb_prev;
+	struct stat sb_next;
 	FILE *file;
 	char *loaded_list, *loaded_list_end, *thisline, *nextline, *ptr;
 	struct file_stat *fso;
@@ -131,13 +132,13 @@ ensure_statoverrides(void)
 			return;
 		}
 	} else {
-		if (fstat(fileno(file), &stab2))
+		if (fstat(fileno(file), &sb_next))
 			ohshite(_("failed to fstat statoverride file"));
 		if (statoverridefile) {
-			if (fstat(fileno(statoverridefile), &stab1))
+			if (fstat(fileno(statoverridefile), &sb_prev))
 				ohshite(_("failed to fstat previous statoverride file"));
-			if (stab1.st_dev == stab2.st_dev &&
-			    stab1.st_ino == stab2.st_ino) {
+			if (sb_prev.st_dev == sb_next.st_dev &&
+			    sb_prev.st_ino == sb_next.st_ino) {
 				fclose(file);
 				onerr_abort--;
 				return;
@@ -151,15 +152,15 @@ ensure_statoverrides(void)
 
 	/* If the statoverride list is empty we don't need to bother
 	 * reading it. */
-	if (!stab2.st_size) {
+	if (!sb_next.st_size) {
 		onerr_abort--;
 		return;
 	}
 
-	loaded_list = nfmalloc(stab2.st_size);
-	loaded_list_end = loaded_list + stab2.st_size;
+	loaded_list = nfmalloc(sb_next.st_size);
+	loaded_list_end = loaded_list + sb_next.st_size;
 
-	if (fd_read(fileno(file), loaded_list, stab2.st_size) < 0)
+	if (fd_read(fileno(file), loaded_list, sb_next.st_size) < 0)
 		ohshite(_("reading statoverride file '%.250s'"), statoverridename);
 
 	thisline = loaded_list;