summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-02-25 11:29:55 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-02-26 16:00:10 +0900
commite7bcb416af64b6a935ff4ff18476aea606d12ab9 (patch)
tree8ae9ef8526dc455aa6ec480bdcd120fe9bfbbe2e
parent9d6d531527f8ca0d2f40ab99f6a5989934b9bd02 (diff)
avoid #if inside of rb_str_new_cstr
ISO/IEC 9899:1999 section 6.10.3 paragraph 11 explicitly states that "If there are sequences of preprocessing tokens within the list of arguments that would otherwise act as preprocessing directives, the behavior is undefined." rb_str_new_cstr is in fact a macro. We cannot do this.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2925
-rw-r--r--gc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gc.c b/gc.c
index 21c93b165e..7d24235342 100644
--- a/gc.c
+++ b/gc.c
@@ -11331,7 +11331,7 @@ gc_profile_dump_on(VALUE out, VALUE (*append)(VALUE, VALUE))
}
#if GC_PROFILE_MORE_DETAIL
- append(out, rb_str_new_cstr("\n\n" \
+ const char *str = "\n\n" \
"More detail.\n" \
"Prepare Time = Previously GC's rest sweep time\n"
"Index Flags Allocate Inc. Allocate Limit"
@@ -11345,7 +11345,8 @@ gc_profile_dump_on(VALUE out, VALUE (*append)(VALUE, VALUE))
#if GC_PROFILE_DETAIL_MEMORY
" MaxRSS(KB) MinorFLT MajorFLT"
#endif
- "\n"));
+ "\n";
+ append(out, rb_str_new_cstr(str));
for (i = 0; i < count; i++) {
record = &objspace->profile.records[i];