summaryrefslogtreecommitdiff
path: root/lib/libalpm/handle.c
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2014-08-01 14:19:54 -0700
committerAllan McRae <allan@archlinux.org>2014-08-04 14:23:58 +1000
commit2025279eb64c397e408baab7ff686624604f415a (patch)
tree86534a508550250a4e583220b844e09d46a86bb5 /lib/libalpm/handle.c
parentd981f93f18449e2cb7b67bfb417aac4737c84b57 (diff)
downloadpacman-2025279eb64c397e408baab7ff686624604f415a.tar.xz
replace strdup with STRDUP
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm/handle.c')
-rw-r--r--lib/libalpm/handle.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 0efc0a96..fdd269b1 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -417,7 +417,7 @@ int SYMEXPORT alpm_option_set_logfile(alpm_handle_t *handle, const char *logfile
return -1;
}
- handle->logfile = strdup(logfile);
+ STRDUP(handle->logfile, logfile, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
/* free the old logfile path string, and close the stream so logaction
* will reopen a new stream on the new logfile */
@@ -443,7 +443,7 @@ int SYMEXPORT alpm_option_set_gpgdir(alpm_handle_t *handle, const char *gpgdir)
if(handle->gpgdir) {
FREE(handle->gpgdir);
}
- handle->gpgdir = strdup(gpgdir);
+ STRDUP(handle->gpgdir, gpgdir, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
_alpm_log(handle, ALPM_LOG_DEBUG, "option 'gpgdir' = %s\n", handle->gpgdir);
return 0;
@@ -549,11 +549,7 @@ int SYMEXPORT alpm_option_set_arch(alpm_handle_t *handle, const char *arch)
{
CHECK_HANDLE(handle, return -1);
if(handle->arch) FREE(handle->arch);
- if(arch) {
- handle->arch = strdup(arch);
- } else {
- handle->arch = NULL;
- }
+ STRDUP(handle->arch, arch, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
return 0;
}