summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/libalpm/conflict.c8
-rw-r--r--src/pacman/package.c2
-rw-r--r--src/pacman/util.c5
-rw-r--r--src/util/cleanupdelta.c4
-rw-r--r--src/util/testdb.c2
5 files changed, 10 insertions, 11 deletions
diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c
index 319e49d6..fbc988bd 100644
--- a/lib/libalpm/conflict.c
+++ b/lib/libalpm/conflict.c
@@ -287,7 +287,7 @@ static alpm_list_t *add_fileconflict(alpm_list_t *conflicts,
if(name2) {
STRDUP(conflict->ctarget, name2, RET_ERR(PM_ERR_MEMORY, NULL));
} else {
- conflict->ctarget = "";
+ STRDUP(conflict->ctarget, "", RET_ERR(PM_ERR_MEMORY, NULL));
}
conflicts = alpm_list_add(conflicts, conflict);
@@ -299,10 +299,8 @@ static alpm_list_t *add_fileconflict(alpm_list_t *conflicts,
void _alpm_fileconflict_free(pmfileconflict_t *conflict)
{
- if(strlen(conflict->ctarget) > 0) {
- FREE(conflict->ctarget);
- }
- FREE(conflict->file);;
+ FREE(conflict->ctarget);
+ FREE(conflict->file);
FREE(conflict->target);
FREE(conflict);
}
diff --git a/src/pacman/package.c b/src/pacman/package.c
index 335b8b6d..e256dda5 100644
--- a/src/pacman/package.c
+++ b/src/pacman/package.c
@@ -153,7 +153,7 @@ static const char *get_backup_file_status(const char *root,
const char *filename, const char *expected_md5)
{
char path[PATH_MAX];
- char *ret;
+ const char *ret;
snprintf(path, PATH_MAX, "%s%s", root, filename);
diff --git a/src/pacman/util.c b/src/pacman/util.c
index 8d7e8e98..8631075f 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -502,12 +502,13 @@ static alpm_list_t *table_create_format(const alpm_list_t *header,
/* now use the column width info to generate format strings */
for(i = longest_strs; i; i = alpm_list_next(i)) {
+ const char *display;
colwidth = strlen(alpm_list_getdata(i)) + padding;
totalwidth += colwidth;
/* right align the last column for a cleaner table display */
- str = (alpm_list_next(i) != NULL) ? "%%-%ds" : "%%%ds";
- pm_asprintf(&formatstr, str, colwidth);
+ display = (alpm_list_next(i) != NULL) ? "%%-%ds" : "%%%ds";
+ pm_asprintf(&formatstr, display, colwidth);
formats = alpm_list_add(formats, formatstr);
}
diff --git a/src/util/cleanupdelta.c b/src/util/cleanupdelta.c
index 6388e840..ae36d2a2 100644
--- a/src/util/cleanupdelta.c
+++ b/src/util/cleanupdelta.c
@@ -65,7 +65,7 @@ static void checkpkgs(alpm_list_t *pkglist)
}
}
-static void checkdbs(char *dbpath, alpm_list_t *dbnames) {
+static void checkdbs(const char *dbpath, alpm_list_t *dbnames) {
char syncdbpath[PATH_MAX];
pmdb_t *db = NULL;
alpm_list_t *i;
@@ -93,7 +93,7 @@ static void usage(void) {
int main(int argc, char *argv[])
{
- char *dbpath = DBPATH;
+ const char *dbpath = DBPATH;
int a = 1;
alpm_list_t *dbnames = NULL;
diff --git a/src/util/testdb.c b/src/util/testdb.c
index b29e49f4..d8a2fb4d 100644
--- a/src/util/testdb.c
+++ b/src/util/testdb.c
@@ -184,7 +184,7 @@ static void usage(void) {
int main(int argc, char *argv[])
{
int ret = 0;
- char *dbpath = DBPATH;
+ const char *dbpath = DBPATH;
int a = 1;
alpm_list_t *dbnames = NULL;