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 744C41391DB for ; Sun, 16 Mar 2014 06:14:55 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9291EE0A01; Sun, 16 Mar 2014 06:14:53 +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 1CDC9E0A01 for ; Sun, 16 Mar 2014 06:14:53 +0000 (UTC) Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 3FFD033FA8F for ; Sun, 16 Mar 2014 06:14:52 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id AA06518875 for ; Sun, 16 Mar 2014 06:14:50 +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: <1394950069.8f59ad7b9e732fa41f29c9c23ea42f68546d32ec.vapier@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: / X-VCS-Repository: proj/portage-utils X-VCS-Files: qlist.c X-VCS-Directories: / X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: 8f59ad7b9e732fa41f29c9c23ea42f68546d32ec X-VCS-Branch: master Date: Sun, 16 Mar 2014 06:14:50 +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: 7d7ed13d-cef3-40c2-8cde-ad27fc8fabd5 X-Archives-Hash: 6b2d0e084021240a50724372e83bab4c commit: 8f59ad7b9e732fa41f29c9c23ea42f68546d32ec Author: Mike Frysinger gentoo org> AuthorDate: Sun Mar 16 06:07:49 2014 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Sun Mar 16 06:07:49 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage-utils.git;a=commit;h=8f59ad7b qlist: speed up -U flag slightly No need to clear the whole buffer when we use this as a normal C string. --- qlist.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/qlist.c b/qlist.c index 0b0714e..fa5e652 100644 --- a/qlist.c +++ b/qlist.c @@ -56,7 +56,7 @@ static char *grab_pkg_umap(const char *CAT, const char *PV) if ((use = grab_vdb_item("USE", CAT, PV)) == NULL) return NULL; - memset(umap, 0, sizeof(umap)); /* reset the buffer */ + umap[0] = '\0'; /* reset the buffer */ /* grab_vdb is a static function so save it to memory right away */ makeargv(use, &use_argc, &use_argv); @@ -85,8 +85,7 @@ static char *grab_pkg_umap(const char *CAT, const char *PV) sets = del_set(use_argv[i], sets, &ok); sets = add_set(use_argv[i], use_argv[i], sets); } - memset(umap, 0, sizeof(umap)); /* reset the buffer */ - strcpy(umap, ""); + umap[0] = '\0'; /* reset the buffer */ for (ll = sets; ll != NULL; ll = ll->next) { strncat(umap, ll->name, sizeof(umap)-strlen(umap)-1); strncat(umap, " ", sizeof(umap)-strlen(umap)-1);