summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-10 06:01:36 (GMT)
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-10 06:01:36 (GMT)
commit6c396e94f9a081d0510f21dcdb8a53bfab22a97b (patch)
tree1fa26929c95e2141f22635501bffd54571825a90 /time.c
parente564a82a9326ba56601a4d593ca8cd98dbda1938 (diff)
time.c: DATA_PTR is never NULL
* time.c (time_mark): remove NULL check (time_memsize): ditto (time_free): remove, use RUBY_TYPED_DEFAULT_FREE instead [Feature #10219] Tiny improvement on my old Phenom II X4 945 system: $ ruby --disable=gems -e '6000000.times { Time.now }' before: 2.51user 0.00system 0:02.51elapsed 100%CPU after: 2.45user 0.00system 0:02.45elapsed 100%CPU git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r--time.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/time.c b/time.c
index 6248a74..17ba4aa 100644
--- a/time.c
+++ b/time.c
@@ -1782,7 +1782,6 @@ static void
time_mark(void *ptr)
{
struct time_object *tobj = ptr;
- if (!tobj) return;
if (!FIXWV_P(tobj->timew))
rb_gc_mark(w2v(tobj->timew));
rb_gc_mark(tobj->vtm.year);
@@ -1790,21 +1789,15 @@ time_mark(void *ptr)
rb_gc_mark(tobj->vtm.utc_offset);
}
-static void
-time_free(void *tobj)
-{
- if (tobj) xfree(tobj);
-}
-
static size_t
time_memsize(const void *tobj)
{
- return tobj ? sizeof(struct time_object) : 0;
+ return sizeof(struct time_object);
}
static const rb_data_type_t time_data_type = {
"time",
- {time_mark, time_free, time_memsize,},
+ {time_mark, RUBY_TYPED_DEFAULT_FREE, time_memsize,},
NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};