Permalink
Browse files

* string.c (rb_str_replace): swap arguments of OBJ_INFECT.

* eval.c (rb_thread_schedule): should not select a thread which is
  not yet initialized.

* time.c (time_plus): wrong boundary check.

* time.c (time_minus): ditto.


git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@1918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
1 parent 389789c commit 80a71ef0c37cb9852382d4662f470d833c57bcf4 matz committed Dec 18, 2001
Showing with 135 additions and 77 deletions.
  1. +34 −0 ChangeLog
  2. +1 −0 ToDo
  3. +14 −2 class.c
  4. +1 −1 eval.c
  5. +6 −6 ext/Win32API/Win32API.c
  6. +2 −2 ext/etc/etc.c
  7. +14 −15 ext/socket/socket.c
  8. +1 −1 ext/syslog/syslog.c
  9. +1 −1 file.c
  10. +4 −4 misc/ruby-mode.el
  11. +43 −36 string.c
  12. +9 −7 time.c
  13. +3 −0 variable.c
  14. +2 −2 version.h
View
@@ -1,3 +1,12 @@
+Mon Dec 17 18:53:49 2001 K.Kosako <kosako@sofnec.co.jp>
+
+ * string.c (rb_str_replace): swap arguments of OBJ_INFECT.
+
+Tue Dec 18 01:02:13 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_thread_schedule): should not select a thread which is
+ not yet initialized.
+
Mon Dec 17 16:52:20 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* intern.h: add prototypes.
@@ -22,6 +31,12 @@ Mon Dec 17 16:52:20 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* ruby.c (require_libraries): ditto.
+Mon Dec 17 15:41:24 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * time.c (time_plus): wrong boundary check.
+
+ * time.c (time_minus): ditto.
+
Mon Dec 17 15:19:32 2001 Tanaka Akira <akr@m17n.org>
* time.c: new method `gmtoff', `gmt_offset' and `utc_offset'.
@@ -49,8 +64,16 @@ Mon Dec 17 15:19:32 2001 Tanaka Akira <akr@m17n.org>
* missing/strftime.c: fix overflow by tm_year + 1900.
+Mon Dec 17 00:02:04 2001 Guy Decoux <ts@moulon.inra.fr>
+
+<<<<<<< ChangeLog
+ * variable.c (find_class_path): should initialize iv_tbl if it's
+ NULL.
+
+=======
* lib/time.rb: use Time#utc_offset.
+>>>>>>> 1.655
Fri Dec 14 04:23:36 2001 Minero Aoki <aamine@loveruby.net>
* lib/net/pop.rb: new method Net::POP3.APOP
@@ -66,6 +89,17 @@ Fri Dec 14 04:23:36 2001 Minero Aoki <aamine@loveruby.net>
* lib/net/http.rb: ditto.
+Fri Dec 14 00:16:06 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * class.c (rb_define_class): should return the existing class if
+ the class is already defined and its superclass is ideintical to
+ the specified superclass.
+
+ * class.c (rb_define_class_under): ditto.
+
+ * class.c (rb_define_module): should return the existing module if
+ the module is already defined.
+
Thu Dec 13 09:52:59 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* time.c (time_new_internal): avoid loop to calculate negative
View
1 ToDo
@@ -98,6 +98,7 @@ Standard Libraries
* remove dependency on MAXPATHLEN.
* pointer share mechanism similar to one in String for Array.
* deprecate Array#indexes, and Array#indices.
+* require "1.6" etc. by /usr/lib/ruby/1.6/1.6.rb ;-)
Extension Libraries
View
16 class.c
@@ -170,7 +170,13 @@ rb_define_class(name, super)
id = rb_intern(name);
if (rb_const_defined(rb_cObject, id)) {
klass = rb_const_get(rb_cObject, id);
- rb_name_error(id, "%s is already defined", name);
+ if (TYPE(klass) != T_CLASS) {
+ rb_raise(rb_eTypeError, "%s is not a class", name);
+ }
+ if (rb_class_real(RCLASS(klass)->super) != super) {
+ rb_name_error(id, "%s is already defined", name);
+ }
+ return klass;
}
klass = rb_define_class_id(id, super);
st_add_direct(rb_class_tbl, id, klass);
@@ -190,7 +196,13 @@ rb_define_class_under(outer, name, super)
id = rb_intern(name);
if (rb_const_defined_at(outer, id)) {
klass = rb_const_get(outer, id);
- rb_name_error(id, "%s is already defined", name);
+ if (TYPE(klass) != T_CLASS) {
+ rb_raise(rb_eTypeError, "%s is not a class", name);
+ }
+ if (rb_class_real(RCLASS(klass)->super) != super) {
+ rb_name_error(id, "%s is already defined", name);
+ }
+ return klass;
}
klass = rb_define_class_id(id, super);
rb_const_set(outer, id, klass);
View
2 eval.c
@@ -7732,7 +7732,7 @@ rb_thread_schedule()
next = th;
break;
}
- if (th->status == THREAD_RUNNABLE) {
+ if (th->status == THREAD_RUNNABLE && th->stk_ptr) {
if (!next || next->priority < th->priority)
next = th;
}
View
@@ -64,8 +64,8 @@ Win32API_initialize(self, dllname, proc, import, export)
int len;
int ex;
- Check_SafeStr(dllname);
- Check_SafeStr(proc);
+ SafeStringValue(dllname);
+ SafeStringValue(proc);
hdll = LoadLibrary(RSTRING(dllname)->ptr);
if (!hdll)
rb_raise(rb_eRuntimeError, "LoadLibrary: %s\n", RSTRING(dllname)->ptr);
@@ -90,7 +90,7 @@ Win32API_initialize(self, dllname, proc, import, export)
case T_ARRAY:
ptr = RARRAY(import)->ptr;
for (i = 0, len = RARRAY(import)->len; i < len; i++) {
- Check_SafeStr(ptr[i]);
+ SafeStringValue(ptr[i]);
switch (*(char *)RSTRING(ptr[i])->ptr) {
case 'N': case 'n': case 'L': case 'l':
rb_ary_push(a_import, INT2FIX(_T_NUMBER));
@@ -105,7 +105,7 @@ Win32API_initialize(self, dllname, proc, import, export)
}
break;
default:
- Check_SafeStr(import);
+ SafeStringValue(import);
s = RSTRING(import)->ptr;
for (i = 0, len = RSTRING(import)->len; i < len; i++) {
switch (*s++) {
@@ -127,7 +127,7 @@ Win32API_initialize(self, dllname, proc, import, export)
if (NIL_P(export)) {
ex = _T_VOID;
} else {
- Check_SafeStr(export);
+ SafeStringValue(export);
switch (*RSTRING(export)->ptr) {
case 'V': case 'v':
ex = _T_VOID;
@@ -228,7 +228,7 @@ Win32API_Call(argc, argv, obj)
} else if (FIXNUM_P(str)){
pParam = (char *)NUM2ULONG(str);
} else {
- Check_Type(str, T_STRING);
+ StringValue(str);
rb_str_modify(str);
pParam = RSTRING(str)->ptr;
}
View
@@ -117,7 +117,7 @@ etc_getpwnam(obj, nam)
#ifdef HAVE_GETPWENT
struct passwd *pwd;
- Check_Type(nam, T_STRING);
+ StringValue(nam);
pwd = getpwnam(RSTRING(nam)->ptr);
if (pwd == 0) rb_raise(rb_eArgError, "can't find user for %s", RSTRING(nam)->ptr);
return setup_passwd(pwd);
@@ -194,7 +194,7 @@ etc_getgrnam(obj, nam)
#ifdef HAVE_GETGRENT
struct group *grp;
- Check_Type(nam, T_STRING);
+ StringValue(nam);
grp = getgrnam(RSTRING(nam)->ptr);
if (grp == 0) rb_raise(rb_eArgError, "can't find group for %s", RSTRING(nam)->ptr);
return setup_group(grp);
View
@@ -561,7 +561,7 @@ ip_addrsetup(host, port)
else {
char *name;
- Check_SafeStr(host);
+ SafeStringValue(host);
name = RSTRING(host)->ptr;
if (*name == 0) {
mkinetaddr(INADDR_ANY, hbuf, sizeof(hbuf));
@@ -793,7 +793,7 @@ load_addr_info(h, serv, type, res)
int error;
if (!NIL_P(h)) {
- Check_SafeStr(h);
+ SafeStringValue(h);
host = RSTRING(h)->ptr;
}
else {
@@ -804,7 +804,7 @@ load_addr_info(h, serv, type, res)
portp = pbuf;
}
else {
- Check_SafeStr(serv);
+ SafeStringValue(serv);
if (RSTRING(serv)->len >= sizeof(pbuf))
rb_raise(rb_eArgError, "servicename too long (%d)", RSTRING(serv)->len);
strcpy(pbuf, RSTRING(serv)->ptr);
@@ -918,10 +918,9 @@ tcp_s_open(argc, argv, class)
&remote_host, &remote_serv,
&local_host, &local_serv);
- Check_SafeStr(remote_host);
-
+ SafeStringValue(remote_host);
if (!NIL_P(local_host)) {
- Check_SafeStr(local_host);
+ SafeStringValue(local_host);
}
return open_inet(class, remote_host, remote_serv,
@@ -940,7 +939,7 @@ socks_s_open(class, host, serv)
init = 1;
}
- Check_SafeStr(host);
+ SafeStringValue(host);
return open_inet(class, host, serv, Qnil, Qnil, INET_SOCKS);
}
@@ -1150,23 +1149,23 @@ tcp_accept(sock)
static VALUE
open_unix(class, path, server)
VALUE class;
- struct RString *path;
+ VALUE path;
int server;
{
struct sockaddr_un sockaddr;
int fd, status;
VALUE sock;
OpenFile *fptr;
- Check_SafeStr(path);
+ SafeStringValue(path);
fd = ruby_socket(AF_UNIX, SOCK_STREAM, 0);
if (fd < 0) {
rb_sys_fail("socket(2)");
}
MEMZERO(&sockaddr, struct sockaddr_un, 1);
sockaddr.sun_family = AF_UNIX;
- strncpy(sockaddr.sun_path, path->ptr, sizeof(sockaddr.sun_path)-1);
+ strncpy(sockaddr.sun_path, RSTRING(path)->ptr, sizeof(sockaddr.sun_path)-1);
sockaddr.sun_path[sizeof(sockaddr.sun_path)-1] = '\0';
if (server) {
@@ -1189,7 +1188,7 @@ open_unix(class, path, server)
sock = sock_new(class, fd);
GetOpenFile(sock, fptr);
- fptr->path = strdup(path->ptr);
+ fptr->path = strdup(RSTRING(path)->ptr);
return sock;
}
@@ -1466,7 +1465,7 @@ setup_domain_and_type(domain, dv, type, tv)
char *ptr;
if (TYPE(domain) == T_STRING) {
- Check_SafeStr(domain);
+ SafeStringValue(domain);
ptr = RSTRING(domain)->ptr;
if (strcmp(ptr, "AF_INET") == 0)
*dv = AF_INET;
@@ -1515,7 +1514,7 @@ setup_domain_and_type(domain, dv, type, tv)
*dv = NUM2INT(domain);
}
if (TYPE(type) == T_STRING) {
- Check_SafeStr(type);
+ SafeStringValue(type);
ptr = RSTRING(type)->ptr;
if (strcmp(ptr, "SOCK_STREAM") == 0)
*tv = SOCK_STREAM;
@@ -1597,7 +1596,7 @@ sock_connect(sock, addr)
OpenFile *fptr;
int fd;
- Check_Type(addr, T_STRING);
+ StringValue(addr);
rb_str_modify(addr);
GetOpenFile(sock, fptr);
@@ -1615,7 +1614,7 @@ sock_bind(sock, addr)
{
OpenFile *fptr;
- Check_Type(addr, T_STRING);
+ StringValue(addr);
rb_str_modify(addr);
GetOpenFile(sock, fptr);
View
@@ -62,7 +62,7 @@ static VALUE cSyslog_open(int argc, VALUE *argv, VALUE self)
fac = INT2NUM(LOG_USER);
}
- Check_SafeStr(ident);
+ SafeStringValue(ident);
syslog_ident = ident;
syslog_options = opt;
syslog_facility = fac;
View
2 file.c
@@ -1908,7 +1908,7 @@ rb_stat_init(obj, fname)
{
struct stat st, *nst;
- Check_SafeStr(fname);
+ SafeStringValue(fname);
if (stat(RSTRING(fname)->ptr, &st) == -1) {
rb_sys_fail(RSTRING(fname)->ptr);
View
@@ -680,22 +680,22 @@ An end of a defun is found by moving forward from the beginning of one."
("\\(#\\)[{$@]" 1 (1 . nil))
;; the last $' in the string ,'...$' is not variable
;; the last ?' in the string ,'...?' is not ascii code
- ("\\(^\\|[[\\s <+(,=]\\)\\('\\)[^'\n\\\\]*\\(\\\\.[^'\n\\\\]*\\)*[\\?\\$]\\('\\)"
+ ("\\(^\\|[[\\s <+(,=]\\)\\('\\)[^'\n\\\\]*\\(\\\\.[^'\n\\\\]*\\)*[?$]\\('\\)"
(2 (7 . nil))
(4 (7 . nil)))
;; the last $` in the string ,`...$` is not variable
;; the last ?` in the string ,`...?` is not ascii code
- ("\\(^\\|[[\\s <+(,=]\\)\\(`\\)[^`\n\\\\]*\\(\\\\.[^`\n\\\\]*\\)*[\\?\\$]\\(`\\)"
+ ("\\(^\\|[[\\s <+(,=]\\)\\(`\\)[^`\n\\\\]*\\(\\\\.[^`\n\\\\]*\\)*[?$]\\(`\\)"
(2 (7 . nil))
(4 (7 . nil)))
;; the last $" in the string ,"...$" is not variable
;; the last ?" in the string ,"...?" is not ascii code
- ("\\(^\\|[[\\s <+(,=]\\)\\(\"\\)[^\"\n\\\\]*\\(\\\\.[^\"\n\\\\]*\\)*[\\?\\$]\\(\"\\)"
+ ("\\(^\\|[[\\s <+(,=]\\)\\(\"\\)[^\"\n\\\\]*\\(\\\\.[^\"\n\\\\]*\\)*[?$]\\(\"\\)"
(2 (7 . nil))
(4 (7 . nil)))
;; $' $" $` .... are variables
;; ?' ?" ?` are ascii codes
- ("[\\?\\$][#\"'`]" 0 (1 . nil))
+ ("[?$][#\"'`]" 0 (1 . nil))
;; regexps
("\\(^\\|[=(,~?:;]\\|\\(^\\|\\s \\)\\(if\\|elsif\\|unless\\|while\\|until\\|when\\|and\\|or\\|&&\\|||\\)\\|g?sub!?\\|scan\\|split!?\\)\\s *\\(/\\)[^/\n\\\\]*\\(\\\\.[^/\n\\\\]*\\)*\\(/\\)"
(4 (7 . ?/))
Oops, something went wrong.

0 comments on commit 80a71ef

Please sign in to comment.