1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00

Fix warnings reported by -Wwrite-strings

These are places where we stuck a string constant in a variable not
marked as const.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2011-05-04 15:48:47 -05:00
parent c03faa32f3
commit e8a40526cb
5 changed files with 10 additions and 11 deletions

View File

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

View File

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

View File

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

View File

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

View File

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