* Improved mcheck output
* Added minor libalpm const correctness * Mini-memory fixes
This commit is contained in:
parent
55f178c629
commit
3e608e7e85
7 changed files with 14 additions and 22 deletions
|
@ -258,7 +258,7 @@ void *alpm_db_getinfo(PM_DB *db, unsigned char parm)
|
||||||
* @param url url of the server
|
* @param url url of the server
|
||||||
* @return 0 on success, -1 on error (pm_errno is set accordingly)
|
* @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;
|
int found = 0;
|
||||||
|
|
||||||
|
@ -1373,7 +1373,7 @@ int alpm_parse_config(char *file, alpm_cb_db_register callback, const char *this
|
||||||
} else {
|
} else {
|
||||||
if(!strcmp(key, "SERVER")) {
|
if(!strcmp(key, "SERVER")) {
|
||||||
/* add to the list */
|
/* 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 */
|
/* pm_errno is set by alpm_set_option */
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,7 +138,7 @@ PM_DB *alpm_db_register(char *treename);
|
||||||
int alpm_db_unregister(PM_DB *db);
|
int alpm_db_unregister(PM_DB *db);
|
||||||
|
|
||||||
void *alpm_db_getinfo(PM_DB *db, unsigned char parm);
|
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);
|
int alpm_db_update(int level, PM_DB *db);
|
||||||
|
|
||||||
|
|
|
@ -178,8 +178,8 @@ int _alpm_db_read(pmdb_t *db, unsigned int inforeq, pmpkg_t *info)
|
||||||
{
|
{
|
||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX+1];
|
||||||
char line[512];
|
char line[513];
|
||||||
char *lang_tmp;
|
char *lang_tmp;
|
||||||
pmlist_t *tmplist;
|
pmlist_t *tmplist;
|
||||||
char *foo;
|
char *foo;
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
|
|
||||||
download_progress_cb pm_dlcb = NULL;
|
download_progress_cb pm_dlcb = NULL;
|
||||||
|
|
||||||
pmserver_t *_alpm_server_new(char *url)
|
pmserver_t *_alpm_server_new(const char *url)
|
||||||
{
|
{
|
||||||
struct url *u;
|
struct url *u;
|
||||||
pmserver_t *server;
|
pmserver_t *server;
|
||||||
|
|
|
@ -46,7 +46,7 @@ typedef struct __pmserver_t {
|
||||||
|
|
||||||
typedef void (*download_progress_cb)(const char *filename, int xfered, int total);
|
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);
|
void _alpm_server_free(void *data);
|
||||||
int _alpm_downloadfiles(pmlist_t *servers, const char *localpath, pmlist_t *files);
|
int _alpm_downloadfiles(pmlist_t *servers, const char *localpath, pmlist_t *files);
|
||||||
int _alpm_downloadfiles_forreal(pmlist_t *servers, const char *localpath,
|
int _alpm_downloadfiles_forreal(pmlist_t *servers, const char *localpath,
|
||||||
|
|
|
@ -5,7 +5,7 @@ SUBDIRS = po
|
||||||
localedir = $(datadir)/locale
|
localedir = $(datadir)/locale
|
||||||
DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
|
DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
|
||||||
|
|
||||||
AM_CFLAGS = -D_GNU_SOURCE \
|
AM_CFLAGS = $(CFLAGS) -D_GNU_SOURCE \
|
||||||
-I$(top_srcdir)/lib/libalpm \
|
-I$(top_srcdir)/lib/libalpm \
|
||||||
-I$(top_srcdir)/lib/libfetch
|
-I$(top_srcdir)/lib/libfetch
|
||||||
|
|
||||||
|
|
|
@ -91,21 +91,21 @@ void mcheck_abort(enum mcheck_status status)
|
||||||
switch(status)
|
switch(status)
|
||||||
{
|
{
|
||||||
case MCHECK_DISABLED:
|
case MCHECK_DISABLED:
|
||||||
fputs("mcheck: disabled, no checking can be done", stderr);
|
fputs("mcheck: disabled, no checking can be done\n", stderr);
|
||||||
break;
|
break;
|
||||||
case MCHECK_OK:
|
case MCHECK_OK:
|
||||||
fputs("mcheck: block ok", stderr);
|
fputs("mcheck: block ok", stderr);
|
||||||
break;
|
break;
|
||||||
case MCHECK_HEAD:
|
case MCHECK_HEAD:
|
||||||
fputs("mcheck: inconsistancy at block head (underrun)", stderr);
|
fputs("mcheck: inconsistancy at block head (underrun)\n", stderr);
|
||||||
abort();
|
abort();
|
||||||
break;
|
break;
|
||||||
case MCHECK_TAIL:
|
case MCHECK_TAIL:
|
||||||
fputs("mcheck: inconsistancy at block tail (overrun)", stderr);
|
fputs("mcheck: inconsistancy at block tail (overrun)\n", stderr);
|
||||||
abort();
|
abort();
|
||||||
break;
|
break;
|
||||||
case MCHECK_FREE:
|
case MCHECK_FREE:
|
||||||
fputs("mcheck: block has already been freed", stderr);
|
fputs("mcheck: block has already been freed\n", stderr);
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -235,11 +235,6 @@ static void cleanup(int signum)
|
||||||
FREELIST(pm_targets);
|
FREELIST(pm_targets);
|
||||||
FREECONF(config);
|
FREECONF(config);
|
||||||
|
|
||||||
#if defined(PACMAN_DEBUG) && !defined(CYGWIN) && !defined(BSD)
|
|
||||||
/* debug */
|
|
||||||
muntrace();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(neednl) {
|
if(neednl) {
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
}
|
}
|
||||||
|
@ -354,7 +349,7 @@ static int parseargs(int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
if(config->dbpath) {
|
if(config->dbpath) {
|
||||||
free(config->dbpath);
|
FREE(config->dbpath);
|
||||||
}
|
}
|
||||||
config->dbpath = strdup(optarg);
|
config->dbpath = strdup(optarg);
|
||||||
break;
|
break;
|
||||||
|
@ -442,11 +437,8 @@ int main(int argc, char *argv[])
|
||||||
list_t *lp;
|
list_t *lp;
|
||||||
|
|
||||||
#if defined(PACMAN_DEBUG) && !defined(CYGWIN) && !defined(BSD)
|
#if defined(PACMAN_DEBUG) && !defined(CYGWIN) && !defined(BSD)
|
||||||
/* debug */
|
mcheck(mcheck_abort);
|
||||||
mtrace();
|
|
||||||
mcheck(0);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cenv = getenv("COLUMNS");
|
cenv = getenv("COLUMNS");
|
||||||
if(cenv != NULL) {
|
if(cenv != NULL) {
|
||||||
maxcols = atoi(cenv);
|
maxcols = atoi(cenv);
|
||||||
|
|
Loading…
Add table
Reference in a new issue