summaryrefslogtreecommitdiffhomepage
path: root/src/backtrace.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2016-03-03 13:38:12 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2016-03-07 10:59:34 +0900
commit0c28c7d7540713951d917aa31bdf6e2b15303185 (patch)
treedb49c340b016f7026d13aa3f3c224fbec5ae2f0a /src/backtrace.c
parent4e957798512c1118854099badb9ed26a27ad0239 (diff)
downloadmruby-0c28c7d7540713951d917aa31bdf6e2b15303185.tar.gz
mruby-0c28c7d7540713951d917aa31bdf6e2b15303185.zip
change backtrace sep from const char* to char
Diffstat (limited to 'src/backtrace.c')
-rw-r--r--src/backtrace.c16
1 files changed, 8 insertions, 8 deletions
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));