From 3e608e7e858166a15eb929df4d66f35f5e4689c5 Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Wed, 8 Nov 2006 08:14:29 +0000 Subject: * Improved mcheck output * Added minor libalpm const correctness * Mini-memory fixes --- lib/libalpm/alpm.c | 4 ++-- lib/libalpm/alpm.h | 2 +- lib/libalpm/be_files.c | 4 ++-- lib/libalpm/server.c | 2 +- lib/libalpm/server.h | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) (limited to 'lib/libalpm') diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c index 9f6271f1..37db1394 100644 --- a/lib/libalpm/alpm.c +++ b/lib/libalpm/alpm.c @@ -258,7 +258,7 @@ void *alpm_db_getinfo(PM_DB *db, unsigned char parm) * @param url url of the server * @return 0 on success, -1 on error (pm_errno is set accordingly) */ -int alpm_db_setserver(pmdb_t *db, char *url) +int alpm_db_setserver(pmdb_t *db, const char *url) { int found = 0; @@ -1373,7 +1373,7 @@ int alpm_parse_config(char *file, alpm_cb_db_register callback, const char *this } else { if(!strcmp(key, "SERVER")) { /* add to the list */ - if(alpm_db_setserver(db, strdup(ptr)) != 0) { + if(alpm_db_setserver(db, ptr) != 0) { /* pm_errno is set by alpm_set_option */ return(-1); } diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index d437d260..af0dbc31 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -138,7 +138,7 @@ PM_DB *alpm_db_register(char *treename); int alpm_db_unregister(PM_DB *db); void *alpm_db_getinfo(PM_DB *db, unsigned char parm); -int alpm_db_setserver(PM_DB *db, char *url); +int alpm_db_setserver(PM_DB *db, const char *url); int alpm_db_update(int level, PM_DB *db); diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c index f90f6979..563f3216 100644 --- a/lib/libalpm/be_files.c +++ b/lib/libalpm/be_files.c @@ -178,8 +178,8 @@ int _alpm_db_read(pmdb_t *db, unsigned int inforeq, pmpkg_t *info) { FILE *fp = NULL; struct stat buf; - char path[PATH_MAX]; - char line[512]; + char path[PATH_MAX+1]; + char line[513]; char *lang_tmp; pmlist_t *tmplist; char *foo; diff --git a/lib/libalpm/server.c b/lib/libalpm/server.c index 35905489..ce39cb5a 100644 --- a/lib/libalpm/server.c +++ b/lib/libalpm/server.c @@ -40,7 +40,7 @@ download_progress_cb pm_dlcb = NULL; -pmserver_t *_alpm_server_new(char *url) +pmserver_t *_alpm_server_new(const char *url) { struct url *u; pmserver_t *server; diff --git a/lib/libalpm/server.h b/lib/libalpm/server.h index 258df223..73353189 100644 --- a/lib/libalpm/server.h +++ b/lib/libalpm/server.h @@ -46,7 +46,7 @@ typedef struct __pmserver_t { typedef void (*download_progress_cb)(const char *filename, int xfered, int total); -pmserver_t *_alpm_server_new(char *url); +pmserver_t *_alpm_server_new(const char *url); void _alpm_server_free(void *data); int _alpm_downloadfiles(pmlist_t *servers, const char *localpath, pmlist_t *files); int _alpm_downloadfiles_forreal(pmlist_t *servers, const char *localpath, -- cgit v1.2.3-54-g00ecf