summaryrefslogtreecommitdiff
path: root/debug.c
diff options
context:
space:
mode:
authorKoichi Sasada <[email protected]>2023-04-26 17:05:32 +0900
committerKoichi Sasada <[email protected]>2023-04-26 17:57:32 +0900
commit06b68db7cfd194de2c7c0bd45e18692f6f8a7b87 ()
treeabb738cba3297e31f5d1362871bac65d549b20da /debug.c
parent457824e2d3ddebef6435d43e0a4b22f738f9fae4 (diff)
show a separator even if `ec` is NULL.
`RUBY_DEBUG_LOG()` doesn't show anything if `GET_EC()` returns NULL, but print a separator "\t" to make consistent TSV.
Notes: Merged: https://.com/ruby/ruby/pull/7761
-rw-r--r--debug.c25
1 files changed, 12 insertions, 13 deletions
@@ -540,20 +540,19 @@ ruby_debug_log(const char *file, int line, const char *func_name, const char *fm
rb_execution_context_t *ec = rb_current_execution_context(false);
- if (ec) {
- // Ruby location
- int ruby_line;
- const char *ruby_file = rb_source_location_cstr(&ruby_line);
- if (len < MAX_DEBUG_LOG_MESSAGE_LEN) {
- if (ruby_file) {
- r = snprintf(buff + len, MAX_DEBUG_LOG_MESSAGE_LEN - len, "\t%s:%d", pretty_filename(ruby_file), ruby_line);
- }
- else {
- r = snprintf(buff + len, MAX_DEBUG_LOG_MESSAGE_LEN - len, "\t");
- }
- if (r < 0) rb_bug("ruby_debug_log returns %d\n", r);
- len += r;
}
}
#ifdef RUBY_NT_SERIAL