summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-01-07 05:27:01 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-01-07 05:27:01 +0000
commitc9f4686694542543864895d6c61c1ef58d58a564 (patch)
treef078d8b669b793ff8665e26d445cb50dabec75e0
parent6a100f3ce470fe659a88e46138068b7a8611f650 (diff)
downloadruby-c9f4686694542543864895d6c61c1ef58d58a564.tar.gz
* string.c (rb_str_new2): NULL pointer check added.
* class.c (rb_define_module_under): should locate predefined module using rb_const_defined_at(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog9
-rw-r--r--class.c4
-rw-r--r--range.c12
-rw-r--r--regex.c13
-rw-r--r--string.c3
5 files changed, 20 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index ef4f79fcd1..a83c3ecf15 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,10 +9,19 @@ Sat Jan 5 13:18:11 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* range.c (range_member): beginning check was
wrong. [ruby-talk:30252]
+Sat Jan 5 03:07:34 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_new2): NULL pointer check added.
+
Sat Jan 5 00:19:12 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* parse.y (yycompile): strdup()'ed twice.
+Fri Jan 4 18:29:10 2002 Michal Rokos <m.rokos@sh.cvut.cz>
+
+ * class.c (rb_define_module_under): should locate predefined
+ module using rb_const_defined_at().
+
Fri Jan 4 17:23:49 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* misc/ruby-mode.el (ruby-forward-string): forward a string. [new]
diff --git a/class.c b/class.c
index edfc9dd098..238c3b3efe 100644
--- a/class.c
+++ b/class.c
@@ -266,8 +266,8 @@ rb_define_module_under(outer, name)
ID id;
id = rb_intern(name);
- if (rb_const_defined(outer, id)) {
- module = rb_const_get(rb_cObject, id);
+ if (rb_const_defined_at(outer, id)) {
+ module = rb_const_get(outer, id);
if (TYPE(module) == T_MODULE)
return module;
rb_raise(rb_eTypeError, "%s::%s is not a module",
diff --git a/range.c b/range.c
index b18951dcbc..cd1413811f 100644
--- a/range.c
+++ b/range.c
@@ -106,7 +106,7 @@ range_eq(range, obj)
}
static int
-r_eq(a,b)
+r_eq(a, b)
VALUE a, b;
{
VALUE r;
@@ -119,22 +119,22 @@ r_eq(a,b)
}
static int
-r_lt(a,b)
+r_lt(a, b)
VALUE a, b;
{
VALUE r = rb_funcall(a, id_cmp, 1, b);
- if (NUM2LONG(r) < 0) return Qtrue;
+ if (rb_cmpint(r) < 0) return Qtrue;
return Qfalse;
}
static int
-r_le(a,b)
+r_le(a, b)
VALUE a, b;
{
VALUE r = rb_funcall(a, id_cmp, 1, b);
- if (NUM2LONG(r) <= 0) return Qtrue;
+ if (rb_cmpint(r) <= 0) return Qtrue;
return Qfalse;
}
@@ -144,7 +144,7 @@ r_gt(a,b)
{
VALUE r = rb_funcall(a, id_cmp, 1, b);
- if (NUM2LONG(r) > 0) return Qtrue;
+ if (rb_cmpint(r) > 0) return Qtrue;
return Qfalse;
}
diff --git a/regex.c b/regex.c
index 4b99d90317..99847afba3 100644
--- a/regex.c
+++ b/regex.c
@@ -2377,19 +2377,6 @@ re_compile_pattern(pattern, size, bufp)
if (*laststart == anychar_repeat) {
bufp->options |= RE_OPTIMIZE_ANCHOR;
}
- else if (*laststart == on_failure_jump) {
- int mcnt;
-
- laststart++;
- EXTRACT_NUMBER_AND_INCR(mcnt, laststart);
- if (*laststart == charset || *laststart == charset_not) {
- p0 = laststart;
- mcnt = *++p0;
- p0 += mcnt+1;
- mcnt = EXTRACT_UNSIGNED_AND_INCR(p0);
- p0 += 8*mcnt;
- }
- }
}
bufp->used = b - bufp->buffer;
diff --git a/string.c b/string.c
index 49b44fa850..77794d9849 100644
--- a/string.c
+++ b/string.c
@@ -80,6 +80,9 @@ VALUE
rb_str_new2(ptr)
const char *ptr;
{
+ if (!ptr) {
+ rb_raise(rb_eArgError, "NULL pointer given");
+ }
return rb_str_new(ptr, strlen(ptr));
}