mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
use PRId64/32 where available for printing fixnums (issue #479)
This commit is contained in:
parent
f5a228ee9e
commit
0efa071672
3 changed files with 15 additions and 4 deletions
|
@ -635,7 +635,7 @@ sexp sexp_load_image (const char* filename, off_t offset, sexp_uint_t heap_free_
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if (offset > 0 && fseek(fp, offset, SEEK_SET) < 0) {
|
if (offset > 0 && fseek(fp, offset, SEEK_SET) < 0) {
|
||||||
snprintf(gc_heap_err_str, ERR_STR_SIZE, "couldn't seek to image offset: %s -> "PRIoff": %s\n", filename, offset, strerror(errno));
|
snprintf(gc_heap_err_str, ERR_STR_SIZE, "couldn't seek to image offset: %s -> %"SEXP_PRIdOFF": %s\n", filename, offset, strerror(errno));
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -283,9 +283,20 @@ typedef short sexp_int32_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__APPLE__) || defined(_WIN64) || (defined(__CYGWIN__) && __SIZEOF_POINTER__ == 8)
|
#if defined(__APPLE__) || defined(_WIN64) || (defined(__CYGWIN__) && __SIZEOF_POINTER__ == 8)
|
||||||
#define PRIoff "%lld"
|
#define SEXP_PRIdOFF "lld"
|
||||||
#else
|
#else
|
||||||
#define PRIoff "%ld"
|
#define SEXP_PRIdOFF "ld"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__GNUC__) || defined(_WIN64) || defined(__APPLE__)
|
||||||
|
#include <stdint.h>
|
||||||
|
#if SEXP_64_BIT
|
||||||
|
#define SEXP_PRIdFIXNUM PRId64
|
||||||
|
#else
|
||||||
|
#define SEXP_PRIdFIXNUM PRId32
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define SEXP_PRIdFIXNUM "ld"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SEXP_USE_LONG_PROCEDURE_ARGS
|
#if SEXP_USE_LONG_PROCEDURE_ARGS
|
||||||
|
|
2
sexp.c
2
sexp.c
|
@ -2111,7 +2111,7 @@ sexp sexp_write_one (sexp ctx, sexp obj, sexp out) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (sexp_fixnump(obj)) {
|
} else if (sexp_fixnump(obj)) {
|
||||||
snprintf(numbuf, NUMBUF_LEN, "%ld", (long)sexp_unbox_fixnum(obj));
|
snprintf(numbuf, NUMBUF_LEN, "%" SEXP_PRIdFIXNUM, (long)sexp_unbox_fixnum(obj));
|
||||||
sexp_write_string(ctx, numbuf, out);
|
sexp_write_string(ctx, numbuf, out);
|
||||||
#if SEXP_USE_IMMEDIATE_FLONUMS
|
#if SEXP_USE_IMMEDIATE_FLONUMS
|
||||||
} else if (sexp_flonump(obj)) {
|
} else if (sexp_flonump(obj)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue