replace strdup with STRDUP

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Andrew Gregory 2014-08-01 14:19:54 -07:00 committed by Allan McRae
parent d981f93f18
commit 2025279eb6
3 changed files with 7 additions and 11 deletions

View File

@ -112,7 +112,7 @@ static alpm_list_t *mount_point_list(alpm_handle_t *handle)
while((mnt = getmntent(fp))) {
CALLOC(mp, 1, sizeof(alpm_mountpoint_t), RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
mp->mount_dir = strdup(mnt->mnt_dir);
STRDUP(mp->mount_dir, mnt->mnt_dir, RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
mp->mount_dir_len = strlen(mp->mount_dir);
mount_points = alpm_list_add(mount_points, mp);
@ -135,7 +135,7 @@ static alpm_list_t *mount_point_list(alpm_handle_t *handle)
while((ret = getmntent(fp, &mnt)) == 0) {
CALLOC(mp, 1, sizeof(alpm_mountpoint_t), RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
mp->mount_dir = strdup(mnt->mnt_mountp);
STRDUP(mp->mount_dir, mnt->mnt_mountp, RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
mp->mount_dir_len = strlen(mp->mount_dir);
mount_points = alpm_list_add(mount_points, mp);
@ -162,7 +162,7 @@ static alpm_list_t *mount_point_list(alpm_handle_t *handle)
for(; entries-- > 0; fsp++) {
CALLOC(mp, 1, sizeof(alpm_mountpoint_t), RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
mp->mount_dir = strdup(fsp->f_mntonname);
STRDUP(mp->mount_dir, fsp->f_mntonname, RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
mp->mount_dir_len = strlen(mp->mount_dir);
memcpy(&(mp->fsp), fsp, sizeof(FSSTATSTYPE));
#if defined(HAVE_GETMNTINFO_STATVFS) && defined(HAVE_STRUCT_STATVFS_F_FLAG)

View File

@ -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;
}

View File

@ -613,7 +613,7 @@ int _alpm_pkg_dup(alpm_pkg_t *pkg, alpm_pkg_t **new_ptr)
newpkg->infolevel = pkg->infolevel;
newpkg->origin = pkg->origin;
if(newpkg->origin == ALPM_PKG_FROM_FILE) {
newpkg->origin_data.file = strdup(pkg->origin_data.file);
STRDUP(newpkg->origin_data.file, pkg->origin_data.file, goto cleanup);
} else {
newpkg->origin_data.db = pkg->origin_data.db;
}