jcs
/subtext
/amendments
/62
util: Fix some panic() strings
jcs made amendment 62 over 2 years ago
--- util.c Fri Jan 21 14:31:05 2022
+++ util.c Sat Jan 22 20:44:46 2022
@@ -86,7 +86,7 @@ xmalloc(size_t size)
panic("xmalloc: zero size");
ptr = malloc(size);
if (ptr == NULL)
- panic("xmalloc: allocating %zu bytes", size);
+ panic("xmalloc(%lu) failed", size);
return ptr;
}
@@ -105,7 +105,7 @@ xcalloc(size_t nmemb, size_t size)
ptr = calloc(nmemb, size);
if (ptr == NULL)
- panic("xcalloc: allocating %zu * %zu bytes", nmemb, size);
+ panic("xcalloc(%lu, %lu) failed", nmemb, size);
return ptr;
}
@@ -116,7 +116,7 @@ xrealloc(void *src, size_t size)
ret = realloc(src, size);
if (ret == NULL)
- panic("Couldn't realloc %lu bytes of memory", size);
+ panic("realloc(%lu) failed", size);
return ret;
}
@@ -127,7 +127,7 @@ xmallocarray(size_t nmemb, size_t size)
{
if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) &&
nmemb > 0 && SIZE_MAX / nmemb < size)
- panic("xmallocarray");
+ panic("xmallocarray(%lu, %lu) failed", nmemb, size);
return xmalloc(size * nmemb);
}
@@ -138,7 +138,7 @@ xreallocarray(void *optr, size_t nmemb, size_t size)
if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) &&
nmemb > 0 && SIZE_MAX / nmemb < size)
- panic("xreallocarray");
+ panic("xreallocarray(%lu, %lu) failed", nmemb, size);
return xrealloc(optr, size * nmemb);
}