From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 59634138A87 for ; Tue, 24 Feb 2015 01:26:29 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id AFFF3E08E0; Tue, 24 Feb 2015 01:26:16 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id DC8E9E08E0 for ; Tue, 24 Feb 2015 01:26:10 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 26E5234096B for ; Tue, 24 Feb 2015 01:26:09 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 15F6C126BC for ; Tue, 24 Feb 2015 01:26:05 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1424732531.dca0ef37f0895f169be61657b5704b45d124e6dd.vapier@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: / X-VCS-Repository: proj/portage-utils X-VCS-Files: qmerge.c X-VCS-Directories: / X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: dca0ef37f0895f169be61657b5704b45d124e6dd X-VCS-Branch: master Date: Tue, 24 Feb 2015 01:26:05 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: f5c52479-3e01-49f0-b41b-87e315692be1 X-Archives-Hash: 3ca8a303571e427c411d3ca0ba3686d8 commit: dca0ef37f0895f169be61657b5704b45d124e6dd Author: Mike Frysinger gentoo org> AuthorDate: Mon Feb 23 23:02:11 2015 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Mon Feb 23 23:02:11 2015 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/portage-utils.git;a=commit;h=dca0ef37 qmerge: simplify Packages parsing slightly --- qmerge.c | 66 ++++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/qmerge.c b/qmerge.c index 314a114..4660eff 100644 --- a/qmerge.c +++ b/qmerge.c @@ -1565,28 +1565,28 @@ grab_binpkg_info(const char *name) } continue; } + if ((p = strchr(buf, '\n')) != NULL) *p = 0; - if ((p = strchr(buf, ':')) == NULL) continue; - if ((p = strchr(buf, ' ')) == NULL) + if (p[1] != ' ') continue; *p = 0; - ++p; + p += 2; if (*buf) { /* we dont need all the info */ - if (strcmp(buf, "RDEPEND:") == 0) + if (strcmp(buf, "RDEPEND") == 0) strncpy(pkg->RDEPEND, p, sizeof(Pkg.RDEPEND)); - if (strcmp(buf, "PF:") == 0) + if (strcmp(buf, "PF") == 0) strncpy(pkg->PF, p, sizeof(Pkg.PF)); - if (strcmp(buf, "CATEGORY:") == 0) + if (strcmp(buf, "CATEGORY") == 0) strncpy(pkg->CATEGORY, p, sizeof(Pkg.CATEGORY)); - if (strcmp(buf, "REPO:") == 0) + if (strcmp(buf, "REPO") == 0) strncpy(pkg->REPO, p, sizeof(Pkg.REPO)); - if (strcmp(buf, "CPV:") == 0) { + if (strcmp(buf, "CPV") == 0) { if ((atom = atom_explode(p)) != NULL) { snprintf(buf, sizeof(buf), "%s-%s", atom->PN, atom->PV); if (atom->PR_int) @@ -1596,15 +1596,15 @@ grab_binpkg_info(const char *name) atom_implode(atom); } } - if (strcmp(buf, "SLOT:") == 0) + if (strcmp(buf, "SLOT") == 0) strncpy(pkg->SLOT, p, sizeof(Pkg.SLOT)); - if (strcmp(buf, "USE:") == 0) + if (strcmp(buf, "USE") == 0) strncpy(pkg->USE, p, sizeof(Pkg.USE)); /* checksums. We must have 1 or the other unless --*/ - if (strcmp(buf, "MD5:") == 0) + if (strcmp(buf, "MD5") == 0) strncpy(pkg->MD5, p, sizeof(Pkg.MD5)); - if (strcmp(buf, "SHA1:") == 0) + if (strcmp(buf, "SHA1") == 0) strncpy(pkg->SHA1, p, sizeof(Pkg.SHA1)); } } @@ -1662,18 +1662,18 @@ find_binpkg(const char *name) } continue; } + if ((p = strchr(buf, '\n')) != NULL) *p = 0; - if ((p = strchr(buf, ':')) == NULL) continue; - if ((p = strchr(buf, ' ')) == NULL) + if (p[1] != ' ') continue; *p = 0; - ++p; + p += 2; if (*buf) { - if (strcmp(buf, "CPV:") == 0) { + if (strcmp(buf, "CPV") == 0) { depend_atom *atom; if ((atom = atom_explode(p)) != NULL) { snprintf(buf, sizeof(buf), "%s-%s", atom->PN, atom->PV); @@ -1684,9 +1684,9 @@ find_binpkg(const char *name) atom_implode(atom); } } - if (strcmp(buf, "PF:") == 0) + if (strcmp(buf, "PF") == 0) strncpy(PF, p, sizeof(PF)); - if (strcmp(buf, "CATEGORY:") == 0) + if (strcmp(buf, "CATEGORY") == 0) strncpy(CATEGORY, p, sizeof(CATEGORY)); } } @@ -1731,41 +1731,41 @@ parse_packages(queue *todo) memset(&Pkg, 0, sizeof(Pkg)); continue; } + if ((p = strchr(buf, '\n')) != NULL) *p = 0; - if ((p = strchr(buf, ':')) == NULL) continue; - if ((p = strchr(buf, ' ')) == NULL) + if (p[1] != ' ') continue; *p = 0; - ++p; + p += 2; switch (*buf) { case 'U': - if (strcmp(buf, "USE:") == 0) strncpy(Pkg.USE, p, sizeof(Pkg.USE)); + if (strcmp(buf, "USE") == 0) strncpy(Pkg.USE, p, sizeof(Pkg.USE)); break; case 'P': - if (strcmp(buf, "PF:") == 0) strncpy(Pkg.PF, p, sizeof(Pkg.PF)); + if (strcmp(buf, "PF") == 0) strncpy(Pkg.PF, p, sizeof(Pkg.PF)); break; case 'S': - if (strcmp(buf, "SIZE:") == 0) Pkg.SIZE = atol(p); - if (strcmp(buf, "SLOT:") == 0) strncpy(Pkg.SLOT, p, sizeof(Pkg.SLOT)); - if (strcmp(buf, "SHA1:") == 0) strncpy(Pkg.SHA1, p, sizeof(Pkg.SHA1)); + if (strcmp(buf, "SIZE") == 0) Pkg.SIZE = atol(p); + if (strcmp(buf, "SLOT") == 0) strncpy(Pkg.SLOT, p, sizeof(Pkg.SLOT)); + if (strcmp(buf, "SHA1") == 0) strncpy(Pkg.SHA1, p, sizeof(Pkg.SHA1)); break; case 'M': - if (strcmp(buf, "MD5:") == 0) strncpy(Pkg.MD5, p, sizeof(Pkg.MD5)); + if (strcmp(buf, "MD5") == 0) strncpy(Pkg.MD5, p, sizeof(Pkg.MD5)); break; case 'R': - if (strcmp(buf, "REPO:") == 0) strncpy(Pkg.REPO, p, sizeof(Pkg.REPO)); - if (strcmp(buf, "RDEPEND:") == 0) strncpy(Pkg.RDEPEND, p, sizeof(Pkg.RDEPEND)); + if (strcmp(buf, "REPO") == 0) strncpy(Pkg.REPO, p, sizeof(Pkg.REPO)); + if (strcmp(buf, "RDEPEND") == 0) strncpy(Pkg.RDEPEND, p, sizeof(Pkg.RDEPEND)); break; case 'L': - if (strcmp(buf, "LICENSE:") == 0) strncpy(Pkg.LICENSE, p, sizeof(Pkg.LICENSE)); + if (strcmp(buf, "LICENSE") == 0) strncpy(Pkg.LICENSE, p, sizeof(Pkg.LICENSE)); break; case 'C': - if (strcmp(buf, "CATEGORY:") == 0) strncpy(Pkg.CATEGORY, p, sizeof(Pkg.CATEGORY)); - if (strcmp(buf, "CPV:") == 0) { + if (strcmp(buf, "CATEGORY") == 0) strncpy(Pkg.CATEGORY, p, sizeof(Pkg.CATEGORY)); + if (strcmp(buf, "CPV") == 0) { depend_atom *atom; if ((atom = atom_explode(p)) != NULL) { if (atom->PR_int) @@ -1778,7 +1778,7 @@ parse_packages(queue *todo) } break; case 'D': - if (strcmp(buf, "DESC:") == 0) strncpy(Pkg.DESC, p, sizeof(Pkg.DESC)); + if (strcmp(buf, "DESC") == 0) strncpy(Pkg.DESC, p, sizeof(Pkg.DESC)); break; default: break;