1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2001-04-17 15:35:04 +00:00
parent 08d683deb2
commit 0570626cc5
5 changed files with 35 additions and 12 deletions

View file

@ -1,3 +1,8 @@
Wed Apr 18 00:24:40 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* regex.c (re_compile_pattern): char class at either edge of range
should be invalid.
Tue Apr 17 16:54:39 2001 K.Kosako <kosako@sofnec.co.jp> Tue Apr 17 16:54:39 2001 K.Kosako <kosako@sofnec.co.jp>
* eval.c (safe_getter): should use INT2NUM(). * eval.c (safe_getter): should use INT2NUM().

21
dln.c
View file

@ -1214,7 +1214,7 @@ aix_loaderror(const char *pathname)
} }
#endif #endif
void void*
dln_load(file) dln_load(file)
const char *file; const char *file;
{ {
@ -1242,13 +1242,13 @@ dln_load(file)
} }
/* Call the init code */ /* Call the init code */
(*init_fct)(); (*init_fct)();
return; return handle;
#else #else
#ifdef USE_DLN_A_OUT #ifdef USE_DLN_A_OUT
if (load(file) == -1) { if (load(file) == -1) {
goto failed; goto failed;
} }
return; return 0;
#else #else
char buf[MAXPATHLEN]; char buf[MAXPATHLEN];
@ -1274,11 +1274,12 @@ dln_load(file)
} }
if ((init_fct = (void(*)())dlsym(handle, buf)) == NULL) { if ((init_fct = (void(*)())dlsym(handle, buf)) == NULL) {
dlclose(handle);
goto failed; goto failed;
} }
/* Call the init code */ /* Call the init code */
(*init_fct)(); (*init_fct)();
return; return handle;
} }
#endif /* USE_DLN_DLOPEN */ #endif /* USE_DLN_DLOPEN */
@ -1304,7 +1305,7 @@ dln_load(file)
} }
} }
(*init_fct)(); (*init_fct)();
return; return (void*)lib;
} }
#endif /* hpux */ #endif /* hpux */
@ -1321,7 +1322,7 @@ dln_load(file)
aix_loaderror(file); aix_loaderror(file);
} }
(*init_fct)(); (*init_fct)();
return; return (void*)init_fct;
} }
#endif /* _AIX */ #endif /* _AIX */
@ -1360,7 +1361,7 @@ dln_load(file)
init_fct = (void(*)())init_address; init_fct = (void(*)())init_address;
(*init_fct)(); (*init_fct)();
return; return (void*)init_address;
} }
#else/* OPENSTEP dyld functions */ #else/* OPENSTEP dyld functions */
{ {
@ -1390,7 +1391,7 @@ dln_load(file)
init_fct = NSAddressOfSymbol(NSLookupAndBindSymbol(buf)); init_fct = NSAddressOfSymbol(NSLookupAndBindSymbol(buf));
(*init_fct)(); (*init_fct)();
return; return (void*)init_fct;
} }
#endif /* rld or dyld */ #endif /* rld or dyld */
#endif #endif
@ -1438,7 +1439,7 @@ dln_load(file)
/* call module initialize function. */ /* call module initialize function. */
(*init_fct)(); (*init_fct)();
return; return (void*)img_id;
} }
#endif /* __BEOS__*/ #endif /* __BEOS__*/
@ -1486,7 +1487,7 @@ dln_load(file)
init_fct = (void (*)())symAddr; init_fct = (void (*)())symAddr;
(*init_fct)(); (*init_fct)();
return; return (void*)init_fct;
} }
#endif /* __MACOS__ */ #endif /* __MACOS__ */

2
dln.h
View file

@ -29,5 +29,5 @@ char *dln_find_file _((const char*,const char*));
extern char *dln_argv0; extern char *dln_argv0;
#endif #endif
void dln_load _((const char*)); void *dln_load _((const char*));
#endif #endif

9
eval.c
View file

@ -5210,6 +5210,7 @@ rb_f_load(argc, argv)
return Qtrue; return Qtrue;
} }
VALUE ruby_dln_librefs;
static VALUE rb_features; static VALUE rb_features;
static st_table *loading_tbl; static st_table *loading_tbl;
@ -5377,9 +5378,12 @@ rb_f_require(obj, fname)
PUSH_TAG(PROT_NONE); PUSH_TAG(PROT_NONE);
if ((state = EXEC_TAG()) == 0) { if ((state = EXEC_TAG()) == 0) {
void *handle;
load = rb_str_new2(file); load = rb_str_new2(file);
file = RSTRING(load)->ptr; file = RSTRING(load)->ptr;
dln_load(file); handle = dln_load(file);
rb_ary_push(ruby_dln_librefs, INT2NUM((long)handle));
} }
POP_TAG(); POP_TAG();
if (state) JUMP_TAG(state); if (state) JUMP_TAG(state);
@ -5947,6 +5951,9 @@ Init_load()
rb_define_global_function("require", rb_f_require, 1); rb_define_global_function("require", rb_f_require, 1);
rb_define_global_function("autoload", rb_f_autoload, 2); rb_define_global_function("autoload", rb_f_autoload, 2);
rb_global_variable(&ruby_wrapper); rb_global_variable(&ruby_wrapper);
ruby_dln_librefs = rb_ary_new();
rb_global_variable(&ruby_dln_librefs);
} }
static void static void

10
regex.c
View file

@ -1438,6 +1438,10 @@ re_compile_pattern(pattern, size, bufp)
EXTEND_BUFFER; EXTEND_BUFFER;
} }
range_retry: range_retry:
if (range && had_char_class) {
FREE_AND_RETURN(stackb, "invalid regular expression; can't use character class as a end value of range");
goto invalid_pattern;
}
PATFETCH(c); PATFETCH(c);
if (c == ']') { if (c == ']') {
@ -1473,6 +1477,7 @@ re_compile_pattern(pattern, size, bufp)
if (current_mbctype) { if (current_mbctype) {
set_list_bits(0x80, 0xffffffff, b); set_list_bits(0x80, 0xffffffff, b);
} }
had_char_class = 1;
last = -1; last = -1;
continue; continue;
@ -1483,6 +1488,7 @@ re_compile_pattern(pattern, size, bufp)
!current_mbctype && SYNTAX(c) != Sword2)) !current_mbctype && SYNTAX(c) != Sword2))
SET_LIST_BIT(c); SET_LIST_BIT(c);
} }
had_char_class = 1;
last = -1; last = -1;
continue; continue;
@ -1490,6 +1496,7 @@ re_compile_pattern(pattern, size, bufp)
for (c = 0; c < 256; c++) for (c = 0; c < 256; c++)
if (ISSPACE(c)) if (ISSPACE(c))
SET_LIST_BIT(c); SET_LIST_BIT(c);
had_char_class = 1;
last = -1; last = -1;
continue; continue;
@ -1499,12 +1506,14 @@ re_compile_pattern(pattern, size, bufp)
SET_LIST_BIT(c); SET_LIST_BIT(c);
if (current_mbctype) if (current_mbctype)
set_list_bits(0x80, 0xffffffff, b); set_list_bits(0x80, 0xffffffff, b);
had_char_class = 1;
last = -1; last = -1;
continue; continue;
case 'd': case 'd':
for (c = '0'; c <= '9'; c++) for (c = '0'; c <= '9'; c++)
SET_LIST_BIT(c); SET_LIST_BIT(c);
had_char_class = 1;
last = -1; last = -1;
continue; continue;
@ -1514,6 +1523,7 @@ re_compile_pattern(pattern, size, bufp)
SET_LIST_BIT(c); SET_LIST_BIT(c);
if (current_mbctype) if (current_mbctype)
set_list_bits(0x80, 0xffffffff, b); set_list_bits(0x80, 0xffffffff, b);
had_char_class = 1;
last = -1; last = -1;
continue; continue;