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

Aaron Griffin aaron at archlinux.org
Fri Jan 19 13:05:19 EST 2007


    Date: Friday, January 19, 2007 @ 13:05:19
  Author: aaron
    Path: /home/cvs-pacman/pacman-lib/lib/libalpm

Modified: package.c (1.45 -> 1.46)

Johannes Weiner <hannes at saeurebad.de> 
* package cleanup (pkg_invalid) refactoring


-----------+
 package.c |   23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)


Index: pacman-lib/lib/libalpm/package.c
diff -u pacman-lib/lib/libalpm/package.c:1.45 pacman-lib/lib/libalpm/package.c:1.46
--- pacman-lib/lib/libalpm/package.c:1.45	Fri Jan 19 13:01:02 2007
+++ pacman-lib/lib/libalpm/package.c	Fri Jan 19 13:05:19 2007
@@ -271,27 +271,15 @@
 			/* parse the info file */
 			if(parse_descfile(descfile, info, 0) == -1) {
 				_alpm_log(PM_LOG_ERROR, _("could not parse the package description file"));
-				pm_errno = PM_ERR_PKG_INVALID;
-				unlink(descfile);
-				FREE(descfile);
-				close(fd);
-				goto error;
+				goto pkg_invalid;
 			}
 			if(!strlen(info->name)) {
 				_alpm_log(PM_LOG_ERROR, _("missing package name in %s"), pkgfile);
-				pm_errno = PM_ERR_PKG_INVALID;
-				unlink(descfile);
-				FREE(descfile);
-				close(fd);
-				goto error;
+				goto pkg_invalid;
 			}
 			if(!strlen(info->version)) {
 				_alpm_log(PM_LOG_ERROR, _("missing package version in %s"), pkgfile);
-				pm_errno = PM_ERR_PKG_INVALID;
-				unlink(descfile);
-				FREE(descfile);
-				close(fd);
-				goto error;
+				goto pkg_invalid;
 			}
 			config = 1;
 			unlink(descfile);
@@ -361,6 +349,11 @@
 
 	return(info);
 
+pkg_invalid:
+	pm_errno = PM_ERR_PKG_INVALID;
+	unlink(descfile);
+	FREE(descfile);
+	close(fd);
 error:
 	FREEPKG(info);
 	archive_read_finish (archive);




More information about the pacman-dev mailing list