Remove non formatting fprintf().

This commit is contained in:
Yukihiro "Matz" Matsumoto
2022-11-22 18:18:30 +09:00
parent 260c2b60df
commit c39ee489e1
3 changed files with 10 additions and 8 deletions
+1 -1
View File
@@ -346,7 +346,7 @@ main(int argc, char **argv)
}
}
else {
fprintf(stderr, "Output file is required\n");
fputs("Output file is required\n", stderr);
return EXIT_FAILURE;
}
result = dump_file(mrb, wfp, args.outfile, mrb_proc_ptr(load), &args);
+1 -1
View File
@@ -290,7 +290,7 @@ main(int argc, char **argv)
/* new interpreter instance */
mrb = mrb_open();
if (mrb == NULL) {
fprintf(stderr, "Invalid mrb_state, exiting test driver");
fputs("Invalid mrb_state, exiting test driver", stderr);
return EXIT_FAILURE;
}
+8 -6
View File
@@ -105,25 +105,27 @@ print_backtrace(mrb_state *mrb, struct RObject *exc, struct RArray *backtrace)
if (n != 0) {
if (n > 1) {
fprintf(stderr, "trace (most recent call last):\n");
fputs("trace (most recent call last):\n", stderr);
}
for (i=n-1,loc=&ARY_PTR(backtrace)[i]; i>0; i--,loc--) {
if (mrb_string_p(*loc)) {
fprintf(stderr, "\t[%d] %.*s\n",
(int)i, (int)RSTRING_LEN(*loc), RSTRING_PTR(*loc));
fprintf(stderr, "\t[%d] ", (int)i);
fwrite(RSTRING_PTR(*loc), (int)RSTRING_LEN(*loc), 1, stderr);
fputc('\n', stderr);
}
}
if (mrb_string_p(*loc)) {
fprintf(stderr, "%.*s: ", (int)RSTRING_LEN(*loc), RSTRING_PTR(*loc));
fwrite(RSTRING_PTR(*loc), (int)RSTRING_LEN(*loc), 1, stderr);
fputs(": ", stderr);
}
}
else {
fprintf(stderr, "%s:0: ", "(unknown)");
fputs("(unknown):0: ", stderr);
}
if (exc == mrb->nomem_err) {
static const char nomem[] = "Out of memory (NoMemoryError)\n";
fwrite(nomem, sizeof(nomem) - 1, 1, stderr);
fwrite(nomem, sizeof(nomem)-1, 1, stderr);
}
else {
mesg = mrb_exc_inspect(mrb, mrb_obj_value(exc));