From f2d696cd515ef0365d9708eb3d1caa439e2cc790 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 18 Oct 2010 16:37:55 -0500 Subject: 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 --- lib/libalpm/handle.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'lib/libalpm/handle.c') 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; } -- cgit v1.2.3-24-g4f1b