- Patch36 (ruby-1.8.x-RHASH_SIZE-rb_hash_lookup-def.patch) also backport

rb_hash_lookup definition (bug 592936)
This commit is contained in:
Mamoru Tasaka 2010-05-17 12:50:20 +00:00
parent 75c801898d
commit 0ad7b67678
3 changed files with 75 additions and 19 deletions

View File

@ -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;

View File

@ -0,0 +1,65 @@
Sat Apr 19 18:42:04 2008 Akinori MUSHA <knu@iDaemons.org>
* 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 <akr@fsij.org>
* 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));

View File

@ -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 <mtasaka@ioa.s.u-tokyo.ac.jp> - 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 <mtasaka@ioa.s.u-tokyo.ac.jp> - 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