From 0c28c7d7540713951d917aa31bdf6e2b15303185 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Thu, 3 Mar 2016 13:38:12 +0900 Subject: change backtrace sep from const char* to char --- src/backtrace.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/backtrace.c b/src/backtrace.c index 45a8cc2de..11082b705 100644 --- a/src/backtrace.c +++ b/src/backtrace.c @@ -19,7 +19,7 @@ struct backtrace_location_raw { int lineno; const char *filename; mrb_sym method_id; - const char *sep; + char sep; struct RClass *klass; }; @@ -28,7 +28,7 @@ struct backtrace_location { int lineno; const char *filename; const char *method; - const char *sep; + char sep; const char *class_name; }; @@ -58,7 +58,7 @@ print_backtrace_i(mrb_state *mrb, struct backtrace_location *loc, void *data) if (loc->method) { if (loc->class_name) { - fprintf(args->stream, ":in %s%s%s", loc->class_name, loc->sep, loc->method); + fprintf(args->stream, ":in %s%c%s", loc->class_name, loc->sep, loc->method); } else { fprintf(args->stream, ":in %s", loc->method); @@ -88,7 +88,7 @@ get_backtrace_i(mrb_state *mrb, struct backtrace_location *loc, void *data) if (loc->class_name) { mrb_str_cat_cstr(mrb, str, loc->class_name); - mrb_str_cat_cstr(mrb, str, loc->sep); + mrb_str_cat(mrb, str, &loc->sep, 1); } mrb_str_cat_cstr(mrb, str, loc->method); @@ -134,10 +134,10 @@ each_backtrace(mrb_state *mrb, mrb_int ciidx, mrb_code *pc0, each_backtrace_func if (loc.lineno == -1) continue; if (ci->target_class == ci->proc->target_class) { - loc.sep = "."; + loc.sep = '.'; } else { - loc.sep = "#"; + loc.sep = '#'; } if (!loc.filename) { @@ -241,7 +241,7 @@ print_backtrace_saved(mrb_state *mrb) method_name = mrb_sym2name(mrb, entry->method_id); if (entry->klass) { - fprintf(stream, ":in %s%s%s", + fprintf(stream, ":in %s%c%s", mrb_class_name(mrb, entry->klass), entry->sep, method_name); @@ -409,7 +409,7 @@ mrb_restore_backtrace(mrb_state *mrb) if (entry->klass) { mrb_str_cat_cstr(mrb, mrb_entry, mrb_class_name(mrb, entry->klass)); - mrb_str_cat_cstr(mrb, mrb_entry, entry->sep); + mrb_str_cat(mrb, mrb_entry, &entry->sep, 1); } mrb_str_cat_cstr(mrb, mrb_entry, mrb_sym2name(mrb, entry->method_id)); -- cgit v1.2.3