X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;f=src%2Fcommon%2Fparse_file.c;h=ded2d5ad7c98bcf8200b4356d6b75e325e0c9ed8;hb=814778ca9bf76eeaf0520b7551103e818a9775d8;hp=82ba4e389bdbbe34d930df6eb7af71a08a5ab485;hpb=891ba8fbca53d920f6b3704827fa6b8aee737de4;p=plomrogue
diff --git a/src/common/parse_file.c b/src/common/parse_file.c
index 82ba4e3..ded2d5a 100644
--- a/src/common/parse_file.c
+++ b/src/common/parse_file.c
@@ -1,6 +1,11 @@
-/* src/common/parse_file.c */
-
-#define _POSIX_C_SOURCE 200809L /* strdup() */
+/* src/common/parse_file.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.
+ */
+
+#define _POSIX_C_SOURCE 200809L /* strdup(), snprintf() */
#include "parse_file.h"
#include /* size_t, NULL */
#include /* FILE, snprintf() */
@@ -77,22 +82,21 @@ extern uint8_t err_line(uint8_t test, char * msg)
{
return 0;
}
- char * f_name = "err_line()";
char * prefix = " Offending line ";
char * affix = ": ";
size_t size = strlen(err_line_intro) + strlen(msg) + strlen(prefix)
+ 10 /* strlen for uint32_t representations */
+ strlen(affix) + strlen(err_line_line) + 1;
- char * err = try_malloc(size, f_name);
+ char * err = try_malloc(size, __func__);
int ret = snprintf(err, size, "%s%s%s%d%s%s", err_line_intro, msg, prefix,
err_line_count, affix, err_line_line);
- exit_trouble(ret < 0, f_name, "snprintf()");
+ exit_trouble(ret < 0, __func__, "snprintf");
if (err_line_exit)
{
exit_err(1, err);
}
- exit_trouble(0 > printf("%s\n", err), f_name, "printf()");
- exit_trouble(EOF == fflush(stdout), f_name, "fflush()");
+ exit_trouble(0 > printf("%s\n", err), __func__, "printf");
+ exit_trouble(EOF == fflush(stdout), __func__, "fflush");
free(err);
return 1;
}