From 0ad7b6767800f78da25d693556967c702e147f76 Mon Sep 17 00:00:00 2001 From: Mamoru Tasaka Date: Mon, 17 May 2010 12:50:20 +0000 Subject: [PATCH] - Patch36 (ruby-1.8.x-RHASH_SIZE-rb_hash_lookup-def.patch) also backport rb_hash_lookup definition (bug 592936) --- ruby-1.8.x-RHASH_SIZE-def.patch | 16 ----- ...-1.8.x-RHASH_SIZE-rb_hash_lookup-def.patch | 65 +++++++++++++++++++ ruby.spec | 13 +++- 3 files changed, 75 insertions(+), 19 deletions(-) delete mode 100644 ruby-1.8.x-RHASH_SIZE-def.patch create mode 100644 ruby-1.8.x-RHASH_SIZE-rb_hash_lookup-def.patch diff --git a/ruby-1.8.x-RHASH_SIZE-def.patch b/ruby-1.8.x-RHASH_SIZE-def.patch deleted file mode 100644 index e7c119a..0000000 --- a/ruby-1.8.x-RHASH_SIZE-def.patch +++ /dev/null @@ -1,16 +0,0 @@ -Index: ruby_1_8/ruby.h -=================================================================== ---- ruby_1_8/ruby.h (revision 13310) -+++ ruby_1_8/ruby.h (revision 13311) -@@ -374,6 +374,11 @@ - int iter_lev; - VALUE ifnone; - }; -+#define RHASH_TBL(h) (RHASH(h)->tbl) -+#define RHASH_ITER_LEV(h) (RHASH(h)->iter_lev) -+#define RHASH_IFNONE(h) (RHASH(h)->ifnone) -+#define RHASH_SIZE(h) (RHASH(h)->tbl->num_entries) -+#define RHASH_EMPTY_P(h) (RHASH_SIZE(h) == 0) - - struct RFile { - struct RBasic basic; diff --git a/ruby-1.8.x-RHASH_SIZE-rb_hash_lookup-def.patch b/ruby-1.8.x-RHASH_SIZE-rb_hash_lookup-def.patch new file mode 100644 index 0000000..503a6b4 --- /dev/null +++ b/ruby-1.8.x-RHASH_SIZE-rb_hash_lookup-def.patch @@ -0,0 +1,65 @@ +Sat Apr 19 18:42:04 2008 Akinori MUSHA + + * intern.h, hash.c (rb_hash_lookup): New internal function to + check if a key exists in a hash, ignoring #default; backported + from 1.9. + +Thu Aug 30 08:24:18 2007 Tanaka Akira + + * ruby.h (RHASH_TBL): defined for compatibility to 1.9. + * (RHASH_ITER_LEV): ditto. + * (RHASH_IFNONE): ditto. + * (RHASH_SIZE): ditto. + * (RHASH_EMPTY_P): ditto. + +Index: ruby_1_8/ruby.h +=================================================================== +--- ruby_1_8/ruby.h (revision 13310) ++++ ruby_1_8/ruby.h (revision 13311) +@@ -374,6 +374,11 @@ + int iter_lev; + VALUE ifnone; + }; ++#define RHASH_TBL(h) (RHASH(h)->tbl) ++#define RHASH_ITER_LEV(h) (RHASH(h)->iter_lev) ++#define RHASH_IFNONE(h) (RHASH(h)->ifnone) ++#define RHASH_SIZE(h) (RHASH(h)->tbl->num_entries) ++#define RHASH_EMPTY_P(h) (RHASH_SIZE(h) == 0) + + struct RFile { + struct RBasic basic; +Index: ruby_1_8/hash.c +=================================================================== +--- ruby_1_8/hash.c (revision 16077) ++++ ruby_1_8/hash.c (revision 16078) +@@ -454,6 +454,18 @@ + return val; + } + ++VALUE ++rb_hash_lookup(hash, key) ++ VALUE hash, key; ++{ ++ VALUE val; ++ ++ if (!st_lookup(RHASH(hash)->tbl, key, &val)) { ++ return Qnil; /* without Hash#default */ ++ } ++ return val; ++} ++ + /* + * call-seq: + * hsh.fetch(key [, default] ) => obj +Index: ruby_1_8/intern.h +=================================================================== +--- ruby_1_8/intern.h (revision 16077) ++++ ruby_1_8/intern.h (revision 16078) +@@ -270,6 +270,7 @@ + VALUE rb_hash_new _((void)); + VALUE rb_hash_freeze _((VALUE)); + VALUE rb_hash_aref _((VALUE, VALUE)); ++VALUE rb_hash_lookup _((VALUE, VALUE)); + VALUE rb_hash_aset _((VALUE, VALUE, VALUE)); + VALUE rb_hash_delete_if _((VALUE)); + VALUE rb_hash_delete _((VALUE,VALUE)); diff --git a/ruby.spec b/ruby.spec index 1e4f1f7..d6fadb8 100644 --- a/ruby.spec +++ b/ruby.spec @@ -18,7 +18,7 @@ Name: ruby Version: %{rubyver}%{?dotpatchlevel} -Release: 3%{?dist} +Release: 3.1%{?dist} License: Ruby or GPLv2 URL: http://www.ruby-lang.org/ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -83,8 +83,11 @@ Patch34: ruby-1.8.6-simplify-openssl-digest.patch Patch35: ruby_1_8_7-gc-open4_096segv.patch # # Patch36, 37: needed to use the head of ext/tk directory of ruby_1_8 branch head -# Patch36: taken from ruby_1_8 branch -Patch36: ruby-1.8.x-RHASH_SIZE-def.patch +# Patch36: taken from ruby_1_8 branch, RHASH_SIZE definition is needed +# for ruby_1_8 head ext/tk +# With this change, rb_hash_lookup becomes also needed for rubygem-nokogiri +# (bug 592936) +Patch36: ruby-1.8.x-RHASH_SIZE-rb_hash_lookup-def.patch # Patch37: flatten(level) feature is in >= 1.8.7, reverting Patch37: ruby-1.8.x-ext_tk-flatten-level-revert.patch # From ruby_1_8 branch: bz 530407 @@ -634,6 +637,10 @@ rm -rf $RPM_BUILD_ROOT %{_emacs_sitestartdir}/ruby-mode-init.el %changelog +* Mon May 17 2010 Mamoru Tasaka - 1.8.6.399-4 +- Patch36 (ruby-1.8.x-RHASH_SIZE-rb_hash_lookup-def.patch) + also backport rb_hash_lookup definition (bug 592936) + * Thu May 13 2010 Mamoru Tasaka - 1.8.6.399-3 - ruby-1.8.x-null-class-must-be-Qnil.patch (bug 530407) - Recreate some patches using upstream svn when available, and