1
0
mirror of https://github.com/moparisthebest/pacman synced 2025-02-28 17:31:52 -05:00

When printing size_t, use %zd

%d was used, which worked for Linux and FreeBSD. Not so for Darwin. The
warning was probably spat out when compiling on x68_64 as well, but no
developers use this architecture as their primary one.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2007-10-29 23:32:58 -05:00
parent be387148c9
commit 6aeda5fbff
5 changed files with 9 additions and 7 deletions

View File

@ -717,7 +717,7 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg,
free(missdepstring);
if(data) {
if((miss = malloc(sizeof(pmdepmissing_t))) == NULL) {
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes\n"), sizeof(pmdepmissing_t));
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %zd bytes\n"), sizeof(pmdepmissing_t));
FREELIST(*data);
pm_errno = PM_ERR_MEMORY;
goto error;
@ -748,7 +748,7 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg,
_alpm_log(PM_LOG_ERROR, _("cannot resolve dependencies for \"%s\"\n"), miss->target);
if(data) {
if((miss = malloc(sizeof(pmdepmissing_t))) == NULL) {
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes\n"), sizeof(pmdepmissing_t));
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %zd bytes\n"), sizeof(pmdepmissing_t));
FREELIST(*data);
pm_errno = PM_ERR_MEMORY;
goto error;

View File

@ -593,7 +593,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
errorout = 1;
if(data) {
if((miss = malloc(sizeof(pmdepmissing_t))) == NULL) {
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes\n"), sizeof(pmdepmissing_t));
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %zd bytes\n"), sizeof(pmdepmissing_t));
FREELIST(*data);
pm_errno = PM_ERR_MEMORY;
ret = -1;
@ -609,7 +609,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
errorout = 1;
if(data) {
if((miss = malloc(sizeof(pmdepmissing_t))) == NULL) {
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes\n"), sizeof(pmdepmissing_t));
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %zd bytes\n"), sizeof(pmdepmissing_t));
FREELIST(*data);
pm_errno = PM_ERR_MEMORY;
ret = -1;

View File

@ -39,7 +39,7 @@
#define _(s) s
#endif
#define ALLOC_FAIL(s) do { _alpm_log(PM_LOG_ERROR, _("alloc failure: could not allocate %d bytes\n"), s); } while(0)
#define ALLOC_FAIL(s) do { _alpm_log(PM_LOG_ERROR, _("alloc failure: could not allocate %zd bytes\n"), s); } while(0)
#define MALLOC(p, s, action) do { p = calloc(1, s); if(p == NULL) { ALLOC_FAIL(s); action; } } while(0)
#define CALLOC(p, l, s, action) do { p = calloc(l, s); if(p == NULL) { ALLOC_FAIL(s); action; } } while(0)

View File

@ -396,8 +396,9 @@ void cb_trans_progress(pmtransprog_t event, const char *pkgname, int percent,
oprlen = strlen(opr);
wcopr = calloc(oprlen, sizeof(wchar_t));
if(!wcopr) {
fprintf(stderr, "malloc failure: could not allocate %d bytes\n",
fprintf(stderr, "malloc failure: could not allocate %zd bytes\n",
strlen(opr) * sizeof(wchar_t));
return;
}
oprlen = mbstowcs(wcopr, opr, oprlen);

View File

@ -32,8 +32,9 @@ config_t *config_new(void)
{
config_t *newconfig = calloc(1, sizeof(config_t));
if(!newconfig) {
fprintf(stderr, "malloc failure: could not allocate %d bytes\n",
fprintf(stderr, "malloc failure: could not allocate %zd bytes\n",
sizeof(config_t));
return(NULL);
}
/* defaults which may get overridden later */
newconfig->op = PM_OP_MAIN;