PERFORCE change 166153 for review

David Forsythe dforsyth at FreeBSD.org
Thu Jul 16 04:53:05 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=166153

Change 166153 by dforsyth at squirrel on 2009/07/16 04:52:10

	Fix pkg_dump

Affected files ...

.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_util.c#12 edit

Differences ...

==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_util.c#12 (text+ko) ====

@@ -87,7 +87,7 @@
 	const char *comment;
 	const char *name;
 	const char *origin;
-	const char *mtree_file;
+	/* const char *mtree_file; */
 
 	const char *cwd;
 	const char *path;
@@ -130,40 +130,43 @@
 
 	fprintf(stream, "\tfiles:\n");
 	files = pkg_files(p);
-	while ((file = *files++) != NULL) {
-		path = file;
-		cwd = pkg_file_get_cwd(p, file);
-		md5 = pkg_file_get_md5(p, file);
-		owner = pkg_file_get_owner(p, file);
-		group = pkg_file_get_group(p, file);
-		mode = pkg_file_get_mode(p, file);
+	if (files != NULL)
+		while ((file = *files++) != NULL) {
+			path = file;
+			cwd = pkg_file_get_cwd(p, file);
+			md5 = pkg_file_get_md5(p, file);
+			owner = pkg_file_get_owner(p, file);
+			group = pkg_file_get_group(p, file);
+			mode = pkg_file_get_mode(p, file);
 
-		fprintf(stream, "\t\t%s\n", 
-			(path != NULL ? path : BAD_OR_UNKNOWN_VALUE));
-		fprintf(stream, "\t\t\tCWD: %s\n",
-			(cwd != NULL ? cwd : BAD_OR_UNKNOWN_VALUE));
-		fprintf(stream, "\t\t\tMD5: %s\n", 
-			(md5 != NULL ? md5 : BAD_OR_UNKNOWN_VALUE));
-		fprintf(stream, "\t\t\tOWNER: %s\n", 
-			(owner != NULL ? owner : BAD_OR_UNKNOWN_VALUE));
-		fprintf(stream, "\t\t\tGROUP: %s\n", 
-			(group != NULL ? group : BAD_OR_UNKNOWN_VALUE));
-		fprintf(stream, "\t\t\tMODE: %s\n",
-			(mode != NULL ? mode : BAD_OR_UNKNOWN_VALUE));
-	}
+			fprintf(stream, "\t\t%s\n", 
+				(path != NULL ? path : BAD_OR_UNKNOWN_VALUE));
+			fprintf(stream, "\t\t\tCWD: %s\n",
+				(cwd != NULL ? cwd : BAD_OR_UNKNOWN_VALUE));
+			fprintf(stream, "\t\t\tMD5: %s\n", 
+				(md5 != NULL ? md5 : BAD_OR_UNKNOWN_VALUE));
+			fprintf(stream, "\t\t\tOWNER: %s\n", 
+				(owner != NULL ? owner : BAD_OR_UNKNOWN_VALUE));
+			fprintf(stream, "\t\t\tGROUP: %s\n", 
+				(group != NULL ? group : BAD_OR_UNKNOWN_VALUE));
+			fprintf(stream, "\t\t\tMODE: %s\n",
+				(mode != NULL ? mode : BAD_OR_UNKNOWN_VALUE));
+		}
 
 	fprintf(stream, "\tdepends:\n");
 	depends = pkg_depends(p);
-	while ((depend = *depends++) != NULL) {
-		name = depends;
-		origin = pkg_depend_get_origin(p, depends);
-		fprintf(stream, "\t\t%s : %s\n", name, origin);
-	}
+	if (depends != NULL)
+		while ((depend = *depends++) != NULL) {
+			name = depend;
+			origin = pkg_depend_get_origin(p, depend);
+			fprintf(stream, "\t\t%s : %s\n", name, origin);
+		}
 
 	fprintf(stream, "\tconflicts:\n");
 	conflicts = pkg_conflicts(p);
-	while ((conflict = *conflicts++) != NULL) {
-		name = conflict;
-		fprintf(stream, "\t\t%s\n", name);
-	}
+	if (conflicts != NULL)
+		while ((conflict = *conflicts++) != NULL) {
+			name = conflict;
+			fprintf(stream, "\t\t%s\n", name);
+		}
 }


More information about the p4-projects mailing list