[pacman-dev] CVS update of pacman-lib/lib/libalpm (package.c)

Aaron Griffin aaron at archlinux.org
Wed Jan 31 20:51:12 EST 2007


    Date: Wednesday, January 31, 2007 @ 20:51:12
  Author: aaron
    Path: /home/cvs-pacman/pacman-lib/lib/libalpm

Modified: package.c (1.53 -> 1.54)

* !strcmp reads funny (as "not string compare" - switch those to == 0, which has
  a positive connotation.
* Added a nice TODO


-----------+
 package.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)


Index: pacman-lib/lib/libalpm/package.c
diff -u pacman-lib/lib/libalpm/package.c:1.53 pacman-lib/lib/libalpm/package.c:1.54
--- pacman-lib/lib/libalpm/package.c:1.53	Tue Jan 30 03:14:11 2007
+++ pacman-lib/lib/libalpm/package.c	Wed Jan 31 20:51:12 2007
@@ -268,12 +268,15 @@
 		RET_ERR(PM_ERR_MEMORY, NULL);
 	}
 
+	/* TODO there is no reason to make temp files to read
+	 * from a libarchive archive, it can be done by reading
+	 * directly from the archive */
 	for(i = 0; archive_read_next_header (archive, &entry) == ARCHIVE_OK; i++) {
 		if(config && filelist && scriptcheck) {
 			/* we have everything we need */
 			break;
 		}
-		if(!strcmp(archive_entry_pathname (entry), ".PKGINFO")) {
+		if(strcmp(archive_entry_pathname (entry), ".PKGINFO") == 0) {
 			/* extract this file into /tmp. it has info for us */
 			descfile = strdup("/tmp/alpm_XXXXXX");
 			fd = mkstemp(descfile);
@@ -296,10 +299,10 @@
 			FREE(descfile);
 			close(fd);
 			continue;
-		} else if(!strcmp(archive_entry_pathname (entry), "._install") || !strcmp(archive_entry_pathname (entry),  ".INSTALL")) {
+		} else if(strcmp(archive_entry_pathname (entry),  ".INSTALL") == 0) {
 			info->scriptlet = 1;
 			scriptcheck = 1;
-		} else if(!strcmp(archive_entry_pathname (entry), ".FILELIST")) {
+		} else if(strcmp(archive_entry_pathname (entry), ".FILELIST") == 0) {
 			/* Build info->files from the filelist */
 			FILE *fp;
 			char *fn;




More information about the pacman-dev mailing list