From 2c5f0577496dbb429a327fc85e72e7f4dcf4250c Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Tue, 10 May 2005 18:58:49 +0000 Subject: [PATCH] Store the result of rb_intern(include?) in a global variable. --- ChangeLog | 6 +++++- ext/ext.c | 9 ++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9d70b36..6195445 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,11 @@ -- -$Id: ChangeLog 34 2005-04-30 13:15:19Z tilman $ +$Id: ChangeLog 35 2005-05-10 18:58:49Z tilman $ ++ +2005-05-10 Tilman Sauerbeck (tilman at code-monkey de) + * ext/ext.c: Store the result of rb_intern("include?") in a + global variable, since it's used very often + 2005-04-30 Tilman Sauerbeck (tilman at code-monkey de) * lib/eet.rb: Tweaked Stream#serialize for performance * lib/eet.rb, ext/ext.c: Re-implemented Stream#serialize and diff --git a/ext/ext.c b/ext/ext.c index 31becea..02ddba9 100644 --- a/ext/ext.c +++ b/ext/ext.c @@ -1,5 +1,5 @@ /* - * $Id: ext.c 34 2005-04-30 13:15:19Z tilman $ + * $Id: ext.c 35 2005-05-10 18:58:49Z tilman $ * * Copyright (c) 2005 Tilman Sauerbeck (tilman at code-monkey de) * @@ -27,8 +27,7 @@ #include #define CHECK_KEY(key) \ - if (rb_funcall (key, rb_intern ("include?"), \ - 1, INT2FIX (0)) == Qtrue) \ + if (rb_funcall (key, id_include, 1, INT2FIX (0)) == Qtrue) \ rb_raise (rb_eArgError, "key must not contain binary zeroes"); #define CHECK_CLOSED(ef) \ @@ -46,6 +45,8 @@ static VALUE c_close (VALUE self); +static VALUE id_include; + static void c_free (Eet_File **ef) { @@ -525,4 +526,6 @@ Init_eet_ext () c = rb_define_class_under (m, "Chunk", rb_cObject); rb_define_method (c, "serialize", chunk_serialize, 0); + + id_include = rb_intern ("include?"); } -- 2.30.2