X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;f=src%2Fcommon%2Frexit.c;h=7eeaccb52d1c92d91a3c9760771888de70b16bde;hb=aec8de097645ebfda6d92adcdf27efa5deb00af0;hp=7e16f12f7c8bce1aeed17635c9f73ef8f963a8c1;hpb=778534bf6946fe0fef17e353c55678d248d8d09d;p=plomrogue
diff --git a/src/common/rexit.c b/src/common/rexit.c
index 7e16f12..7eeaccb 100644
--- a/src/common/rexit.c
+++ b/src/common/rexit.c
@@ -1,4 +1,9 @@
-/* src/common/rexit.c */
+/* src/common/rexit.c
+ *
+ * This file is part of PlomRogue. PlomRogue is licensed under the GPL version 3
+ * or any later version. For details on its copyright, license, and warranties,
+ * see the file NOTICE in the root directory of the PlomRogue source package.
+ */
#include "rexit.h"
#include /* global errno */
@@ -21,14 +26,14 @@ extern void set_cleanup_func(void (* f)())
-extern void exit_err(int err, char * msg)
+extern void exit_err(int err, const char * msg)
{
if (0 == err)
{
return;
}
cleanup_func();
- if (NULL == msg)
+ if (!msg)
{
msg = "Details unknown.";
}
@@ -42,17 +47,16 @@ extern void exit_err(int err, char * msg)
-extern void exit_trouble(int err, char * parent, char * child)
+extern void exit_trouble(int err, const char * parent, const char * child)
{
- char * f_name = "exit_trouble()";
char * p1 = "Trouble in ";
char * p2 = " with ";
char * p3 = ".";
uint16_t size = strlen(p1) + strlen(parent) + strlen(p2) + strlen(child)
+ strlen(p3) + 1;
- char * msg = try_malloc(size, f_name);
+ char * msg = try_malloc(size, __func__);
int test = sprintf(msg, "%s%s%s%s%s", p1, parent, p2, child, p3);
- exit_err(test < 0, "Trouble in exit_trouble() with sprintf()");
+ exit_err(test < 0, "Trouble in exit_trouble with sprintf.");
exit_err(err, msg);
free(msg);
}