[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1757-g4b9e86a
[email protected] (Robin Watts) Fri, 25 Oct 2019 17:49:50 +0000 (UTC)
| Newsgroups | gmane.comp.printing.ghostscript.cvs |
|---|---|
| Message-ID | <[email protected]> |
The ghostpdl branch, master has been updated
via 4b9e86a33b237740df682369300f1a9507dc63c5 (commit)
from 17ad4a12dd40799655b71a93de1209a6a0f24204 (commit)
----------------------------------------------------------------------
commit 4b9e86a33b237740df682369300f1a9507dc63c5
Author: Robin Watts <[email protected]>
Date: Fri Oct 25 18:48:05 2019 +0100
Memento: Fix annoyance with %p
Windows displays %p without a leading 0x. Linux adds a leading 0x.
Use a macro to give consistent results on all platforms.
diff --git a/base/memento.c b/base/memento.c
index 252b482..38d4020 100644
--- a/base/memento.c
+++ b/base/memento.c
@@ -60,9 +60,11 @@ int atexit(void (*)(void));
#ifdef _MSC_VER
#define FMTZ "%llu"
#define FMTZ_CAST _int64
+#define FMTP "0x%p"
#else
#define FMTZ "%zu"
#define FMTZ_CAST size_t
+#define FMTP "%p"
#endif
#define UB(x) ((intptr_t)((x) & 0xFF))
@@ -635,7 +637,7 @@ static void print_stack_default(void *addr)
if (strings == NULL || strings[0] == NULL)
{
- fprintf(stderr, " [0x%p]\n", addr);
+ fprintf(stderr, " ["FMTP"]\n", addr);
}
#ifdef HAVE_LIBDL
else if (strchr(strings[0], ':') == NULL)
@@ -879,12 +881,12 @@ static void Memento_showStacktrace(void **stack, int numberOfFrames)
const char *sym = info.dli_sname ? info.dli_sname : "<unknown>";
char *demangled = __cxa_demangle(sym, NULL, 0, &status);
int offset = stack[i] - info.dli_saddr;
- fprintf(stderr, " [%p]%s(+0x%x)\n", stack[i], demangled && status == 0 ? demangled : sym, offset);
+ fprintf(stderr, " ["FMTP"]%s(+0x%x)\n", stack[i], demangled && status == 0 ? demangled : sym, offset);
free(demangled);
}
else
{
- fprintf(stderr, " [%p]\n", stack[i]);
+ fprintf(stderr, " ["FMTP"]\n", stack[i]);
}
}
}
@@ -1292,7 +1294,7 @@ static int showBlock(Memento_BlkHeader *b, int space)
{
int seq;
VALGRIND_MAKE_MEM_DEFINED(b, sizeof(Memento_BlkHeader));
- fprintf(stderr, "0x%p:(size=" FMTZ ",num=%d)",
+ fprintf(stderr, FMTP":(size=" FMTZ ",num=%d)",
MEMBLK_TOBLK(b), (FMTZ_CAST)b->rawsize, b->sequence);
if (b->label)
fprintf(stderr, "%c(%s)", space, b->label);
@@ -1538,7 +1540,7 @@ static int showInfo(Memento_BlkHeader *b, void *arg)
{
Memento_BlkDetails *details;
- fprintf(stderr, "0x%p:(size="FMTZ",num=%d)",
+ fprintf(stderr, FMTP":(size="FMTZ",num=%d)",
MEMBLK_TOBLK(b), (FMTZ_CAST)b->rawsize, b->sequence);
if (b->label)
fprintf(stderr, " (%s)", b->label);
@@ -2648,7 +2650,7 @@ static int Memento_Internal_checkAllFreed(Memento_BlkHeader *memblk, void *arg)
fprintf(stderr, " ");
showBlock(memblk, ' ');
if (data->freeCorrupt) {
- fprintf(stderr, " index %d (address 0x%p) onwards", (int)data->index,
+ fprintf(stderr, " index %d (address "FMTP") onwards", (int)data->index,
&((char *)MEMBLK_TOBLK(memblk))[data->index]);
if (data->preCorrupt) {
fprintf(stderr, "+ preguard");
@@ -2756,7 +2758,7 @@ int Memento_find(void *a)
data.flags = 0;
Memento_appBlocks(&memento.used, Memento_containsAddr, &data);
if (data.blk != NULL) {
- fprintf(stderr, "Address 0x%p is in %sallocated block ",
+ fprintf(stderr, "Address "FMTP" is in %sallocated block ",
data.addr,
(data.flags == 1 ? "" : (data.flags == 2 ?
"preguard of " : "postguard of ")));
@@ -2769,7 +2771,7 @@ int Memento_find(void *a)
data.flags = 0;
Memento_appBlocks(&memento.free, Memento_containsAddr, &data);
if (data.blk != NULL) {
- fprintf(stderr, "Address 0x%p is in %sfreed block ",
+ fprintf(stderr, "Address "FMTP" is in %sfreed block ",
data.addr,
(data.flags == 1 ? "" : (data.flags == 2 ?
"preguard of " : "postguard of ")));
@@ -2792,7 +2794,7 @@ void Memento_breakOnFree(void *a)
data.flags = 0;
Memento_appBlocks(&memento.used, Memento_containsAddr, &data);
if (data.blk != NULL) {
- fprintf(stderr, "Will stop when address 0x%p (in %sallocated block ",
+ fprintf(stderr, "Will stop when address "FMTP" (in %sallocated block ",
data.addr,
(data.flags == 1 ? "" : (data.flags == 2 ?
"preguard of " : "postguard of ")));
@@ -2808,7 +2810,7 @@ void Memento_breakOnFree(void *a)
data.flags = 0;
Memento_appBlocks(&memento.free, Memento_containsAddr, &data);
if (data.blk != NULL) {
- fprintf(stderr, "Can't stop on free; address 0x%p is in %sfreed block ",
+ fprintf(stderr, "Can't stop on free; address "FMTP" is in %sfreed block ",
data.addr,
(data.flags == 1 ? "" : (data.flags == 2 ?
"preguard of " : "postguard of ")));
@@ -2817,7 +2819,7 @@ void Memento_breakOnFree(void *a)
MEMENTO_UNLOCK();
return;
}
- fprintf(stderr, "Can't stop on free; address 0x%p is not in a known block.\n", a);
+ fprintf(stderr, "Can't stop on free; address "FMTP" is not in a known block.\n", a);
MEMENTO_UNLOCK();
}
@@ -2831,7 +2833,7 @@ void Memento_breakOnRealloc(void *a)
data.flags = 0;
Memento_appBlocks(&memento.used, Memento_containsAddr, &data);
if (data.blk != NULL) {
- fprintf(stderr, "Will stop when address 0x%p (in %sallocated block ",
+ fprintf(stderr, "Will stop when address "FMTP" (in %sallocated block ",
data.addr,
(data.flags == 1 ? "" : (data.flags == 2 ?
"preguard of " : "postguard of ")));
@@ -2847,7 +2849,7 @@ void Memento_breakOnRealloc(void *a)
data.flags = 0;
Memento_appBlocks(&memento.free, Memento_containsAddr, &data);
if (data.blk != NULL) {
- fprintf(stderr, "Can't stop on free/realloc; address 0x%p is in %sfreed block ",
+ fprintf(stderr, "Can't stop on free/realloc; address "FMTP" is in %sfreed block ",
data.addr,
(data.flags == 1 ? "" : (data.flags == 2 ?
"preguard of " : "postguard of ")));
@@ -2856,7 +2858,7 @@ void Memento_breakOnRealloc(void *a)
MEMENTO_UNLOCK();
return;
}
- fprintf(stderr, "Can't stop on free/realloc; address 0x%p is not in a known block.\n", a);
+ fprintf(stderr, "Can't stop on free/realloc; address "FMTP" is not in a known block.\n", a);
MEMENTO_UNLOCK();
}
Summary of changes:
base/memento.c | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)