summaryrefslogtreecommitdiff
path: root/lib/libalpm
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2009-10-20 23:25:38 -0500
committerDan McGee <dan@archlinux.org>2009-10-24 10:10:12 -0500
commit0bc961a8be1adc1dabc4089d7f67a95cb603f450 (patch)
tree8e5dcfa318768708ba3e668ec1987b74ee38dc91 /lib/libalpm
parent748bc8ebd41f5553c139c530358a72a83def7126 (diff)
Reduce unnecessary get_name() function calls
alpm_pkg_get_name() gives us little benefit in backend code besides a NULL check on the package passed in; we could do that ourself if necessary. By changing to direct references in the cases where we are sure we have a valid package, we save a function call each time we need a package name. This function can't be inlined because it is externally accessible. This cuts the calls to get_name() from 1.3 million times in a pacman -Qu operation to around 2400. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/package.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index 572b863e..83a2fb8f 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -573,7 +573,7 @@ alpm_list_t SYMEXPORT *alpm_pkg_compute_requiredby(pmpkg_t *pkg)
}
pmpkg_t *cachepkg = i->data;
if(_alpm_dep_edge(cachepkg, pkg)) {
- const char *cachepkgname = alpm_pkg_get_name(cachepkg);
+ const char *cachepkgname = pkg->name;
reqs = alpm_list_add(reqs, strdup(cachepkgname));
}
}
@@ -896,7 +896,7 @@ int _alpm_pkg_cmp(const void *p1, const void *p2)
{
pmpkg_t *pkg1 = (pmpkg_t *)p1;
pmpkg_t *pkg2 = (pmpkg_t *)p2;
- return(strcmp(alpm_pkg_get_name(pkg1), alpm_pkg_get_name(pkg2)));
+ return(strcmp(pkg1->name, pkg2->name));
}
/* Test for existence of a package in a alpm_list_t*
@@ -915,7 +915,7 @@ pmpkg_t *_alpm_pkg_find(alpm_list_t *haystack, const char *needle)
for(lp = haystack; lp; lp = lp->next) {
pmpkg_t *info = lp->data;
- if(info && strcmp(alpm_pkg_get_name(info), needle) == 0) {
+ if(info && strcmp(info->name, needle) == 0) {
return(info);
}
}