diff options
author | Dan McGee <dan@archlinux.org> | 2010-10-18 16:37:55 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-05-05 12:46:42 -0500 |
commit | f2d696cd515ef0365d9708eb3d1caa439e2cc790 (patch) | |
tree | 148aee903e071e23172dbcc9309b146effc0036e /lib/libalpm | |
parent | 42ab639bf715cbacb3598b6c42388ba4bbb2d3d4 (diff) | |
download | pacman-f2d696cd515ef0365d9708eb3d1caa439e2cc790.tar.xz |
Don't null-check handle lists before setting
This needlessly prevents the easiest way available of clearing any of these
values. We can also do the same for the 'arch' value.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-rw-r--r-- | lib/libalpm/handle.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c index 6bc5f27e..2d6766a5 100644 --- a/lib/libalpm/handle.c +++ b/lib/libalpm/handle.c @@ -416,7 +416,7 @@ int SYMEXPORT alpm_option_set_cachedirs(alpm_list_t *cachedirs) { ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); if(handle->cachedirs) FREELIST(handle->cachedirs); - if(cachedirs) handle->cachedirs = cachedirs; + handle->cachedirs = cachedirs; return 0; } @@ -506,7 +506,7 @@ int SYMEXPORT alpm_option_set_noupgrades(alpm_list_t *noupgrade) { ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); if(handle->noupgrade) FREELIST(handle->noupgrade); - if(noupgrade) handle->noupgrade = noupgrade; + handle->noupgrade = noupgrade; return 0; } @@ -533,7 +533,7 @@ int SYMEXPORT alpm_option_set_noextracts(alpm_list_t *noextract) { ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); if(handle->noextract) FREELIST(handle->noextract); - if(noextract) handle->noextract = noextract; + handle->noextract = noextract; return 0; } @@ -560,7 +560,7 @@ int SYMEXPORT alpm_option_set_ignorepkgs(alpm_list_t *ignorepkgs) { ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); if(handle->ignorepkg) FREELIST(handle->ignorepkg); - if(ignorepkgs) handle->ignorepkg = ignorepkgs; + handle->ignorepkg = ignorepkgs; return 0; } @@ -587,7 +587,7 @@ int SYMEXPORT alpm_option_set_ignoregrps(alpm_list_t *ignoregrps) { ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); if(handle->ignoregrp) FREELIST(handle->ignoregrp); - if(ignoregrps) handle->ignoregrp = ignoregrps; + handle->ignoregrp = ignoregrps; return 0; } @@ -607,7 +607,11 @@ int SYMEXPORT alpm_option_set_arch(const char *arch) { ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); if(handle->arch) FREE(handle->arch); - if(arch) handle->arch = strdup(arch); + if(arch) { + handle->arch = strdup(arch); + } else { + handle->arch = NULL; + } return 0; } |