change backtrace sep from const char* to char

This commit is contained in:
Yukihiro "Matz" Matsumoto
2016-03-03 13:38:12 +09:00
parent 4e95779851
commit 0c28c7d754
2 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -118,7 +118,7 @@ typedef struct {
const char *filename;
int lineno;
struct RClass *klass;
const char *sep;
char sep;
mrb_sym method_id;
} mrb_backtrace_entry;
+8 -8
View File
@@ -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));