summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-29 05:32:57 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-29 05:32:57 (GMT)
commit645116ff25e42b1cfb065ad98e13818c8c5c2a8d (patch)
tree47ed734b95ca72ec176b056b766a0561ef441723 /string.c
parent1be5cb6371048a35d9fb2859ca8a865e982608cf (diff)
RUBY_DTRACE_CREATE_HOOK
* internal.h (RUBY_DTRACE_CREATE_HOOK): macro to call hook at object creation. * vm.c (rb_source_location, rb_source_loc): retrieve source path and line number at once. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/string.c b/string.c
index eb16998..ec6a8eb 100644
--- a/string.c
+++ b/string.c
@@ -624,9 +624,7 @@ str_alloc(VALUE klass)
static inline VALUE
empty_str_alloc(VALUE klass)
{
- if (RUBY_DTRACE_STRING_CREATE_ENABLED()) {
- RUBY_DTRACE_STRING_CREATE(0, rb_sourcefile(), rb_sourceline());
- }
+ RUBY_DTRACE_CREATE_HOOK(STRING, 0);
return str_alloc(klass);
}
@@ -639,9 +637,7 @@ str_new0(VALUE klass, const char *ptr, long len, int termlen)
rb_raise(rb_eArgError, "negative string size (or size too big)");
}
- if (RUBY_DTRACE_STRING_CREATE_ENABLED()) {
- RUBY_DTRACE_STRING_CREATE(len, rb_sourcefile(), rb_sourceline());
- }
+ RUBY_DTRACE_CREATE_HOOK(STRING, len);
str = str_alloc(klass);
if (len > RSTRING_EMBED_LEN_MAX) {
@@ -746,9 +742,7 @@ str_new_static(VALUE klass, const char *ptr, long len, int encindex)
str = str_new(klass, ptr, len);
}
else {
- if (RUBY_DTRACE_STRING_CREATE_ENABLED()) {
- RUBY_DTRACE_STRING_CREATE(len, rb_sourcefile(), rb_sourceline());
- }
+ RUBY_DTRACE_CREATE_HOOK(STRING, len);
str = str_alloc(klass);
RSTRING(str)->as.heap.len = len;
RSTRING(str)->as.heap.ptr = (char *)ptr;
@@ -1314,10 +1308,7 @@ rb_str_dup(VALUE str)
VALUE
rb_str_resurrect(VALUE str)
{
- if (RUBY_DTRACE_STRING_CREATE_ENABLED()) {
- RUBY_DTRACE_STRING_CREATE(RSTRING_LEN(str),
- rb_sourcefile(), rb_sourceline());
- }
+ RUBY_DTRACE_CREATE_HOOK(STRING, RSTRING_LEN(str));
return str_duplicate(rb_cString, str);
}