Port pdumper to unlikely long sprintf output
* src/pdumper.c (dump_ptr_referrer): Port to platforms where sprintf %p generates absurdly long output. (dump_vectorlike): Port to hypothetical platforms where %d generates absurdly long output.
This commit is contained in:
parent
8ff7338fdd
commit
4a25ed300f
1 changed files with 6 additions and 4 deletions
|
@ -677,8 +677,8 @@ static Lisp_Object
|
|||
dump_ptr_referrer (const char *label, void const *address)
|
||||
{
|
||||
char buf[128];
|
||||
buf[0] = '\0';
|
||||
sprintf (buf, "%s @ %p", label, address);
|
||||
if (sizeof buf <= snprintf (buf, sizeof buf, "%s @ %p", label, address))
|
||||
strcpy (buf + sizeof buf - 4, "...");
|
||||
return build_string (buf);
|
||||
}
|
||||
|
||||
|
@ -3145,8 +3145,10 @@ dump_vectorlike (struct dump_context *ctx,
|
|||
case PVEC_TS_NODE:
|
||||
break;
|
||||
}
|
||||
char msg[60];
|
||||
snprintf (msg, sizeof msg, "pseudovector type %d", (int) ptype);
|
||||
int iptype = ptype;
|
||||
static char const fmt[] = "pseudovector type %d";
|
||||
char msg[sizeof fmt - sizeof "%d" + INT_STRLEN_BOUND (iptype) + 1];
|
||||
sprintf (msg, fmt, iptype);
|
||||
error_unsupported_dump_object (ctx, lv, msg);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue