commit: 8f59ad7b9e732fa41f29c9c23ea42f68546d32ec Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> AuthorDate: Sun Mar 16 06:07:49 2014 +0000 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> 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);