diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-04-17 15:35:04 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-04-17 15:35:04 +0000 |
commit | 0570626cc583fd5897f4a16c3a03e45e1d639f37 (patch) | |
tree | c9c5f1b91f6138639b2704989ab875b4a971a6d1 | |
parent | 08d683deb24cae10ac5e2b8328b082573ef171ac (diff) |
preview2
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | dln.c | 21 | ||||
-rw-r--r-- | dln.h | 2 | ||||
-rw-r--r-- | eval.c | 9 | ||||
-rw-r--r-- | regex.c | 10 |
5 files changed, 35 insertions, 12 deletions
@@ -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> * eval.c (safe_getter): should use INT2NUM(). @@ -1214,7 +1214,7 @@ aix_loaderror(const char *pathname) } #endif -void +void* dln_load(file) const char *file; { @@ -1242,13 +1242,13 @@ dln_load(file) } /* Call the init code */ (*init_fct)(); - return; + return handle; #else #ifdef USE_DLN_A_OUT if (load(file) == -1) { goto failed; } - return; + return 0; #else char buf[MAXPATHLEN]; @@ -1274,11 +1274,12 @@ dln_load(file) } if ((init_fct = (void(*)())dlsym(handle, buf)) == NULL) { + dlclose(handle); goto failed; } /* Call the init code */ (*init_fct)(); - return; + return handle; } #endif /* USE_DLN_DLOPEN */ @@ -1304,7 +1305,7 @@ dln_load(file) } } (*init_fct)(); - return; + return (void*)lib; } #endif /* hpux */ @@ -1321,7 +1322,7 @@ dln_load(file) aix_loaderror(file); } (*init_fct)(); - return; + return (void*)init_fct; } #endif /* _AIX */ @@ -1360,7 +1361,7 @@ dln_load(file) init_fct = (void(*)())init_address; (*init_fct)(); - return; + return (void*)init_address; } #else/* OPENSTEP dyld functions */ { @@ -1390,7 +1391,7 @@ dln_load(file) init_fct = NSAddressOfSymbol(NSLookupAndBindSymbol(buf)); (*init_fct)(); - return; + return (void*)init_fct; } #endif /* rld or dyld */ #endif @@ -1438,7 +1439,7 @@ dln_load(file) /* call module initialize function. */ (*init_fct)(); - return; + return (void*)img_id; } #endif /* __BEOS__*/ @@ -1486,7 +1487,7 @@ dln_load(file) init_fct = (void (*)())symAddr; (*init_fct)(); - return; + return (void*)init_fct; } #endif /* __MACOS__ */ @@ -29,5 +29,5 @@ char *dln_find_file _((const char*,const char*)); extern char *dln_argv0; #endif -void dln_load _((const char*)); +void *dln_load _((const char*)); #endif @@ -5210,6 +5210,7 @@ rb_f_load(argc, argv) return Qtrue; } +VALUE ruby_dln_librefs; static VALUE rb_features; static st_table *loading_tbl; @@ -5377,9 +5378,12 @@ rb_f_require(obj, fname) PUSH_TAG(PROT_NONE); if ((state = EXEC_TAG()) == 0) { + void *handle; + load = rb_str_new2(file); file = RSTRING(load)->ptr; - dln_load(file); + handle = dln_load(file); + rb_ary_push(ruby_dln_librefs, INT2NUM((long)handle)); } POP_TAG(); if (state) JUMP_TAG(state); @@ -5947,6 +5951,9 @@ Init_load() rb_define_global_function("require", rb_f_require, 1); rb_define_global_function("autoload", rb_f_autoload, 2); rb_global_variable(&ruby_wrapper); + + ruby_dln_librefs = rb_ary_new(); + rb_global_variable(&ruby_dln_librefs); } static void @@ -1438,6 +1438,10 @@ re_compile_pattern(pattern, size, bufp) EXTEND_BUFFER; } 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); if (c == ']') { @@ -1473,6 +1477,7 @@ re_compile_pattern(pattern, size, bufp) if (current_mbctype) { set_list_bits(0x80, 0xffffffff, b); } + had_char_class = 1; last = -1; continue; @@ -1483,6 +1488,7 @@ re_compile_pattern(pattern, size, bufp) !current_mbctype && SYNTAX(c) != Sword2)) SET_LIST_BIT(c); } + had_char_class = 1; last = -1; continue; @@ -1490,6 +1496,7 @@ re_compile_pattern(pattern, size, bufp) for (c = 0; c < 256; c++) if (ISSPACE(c)) SET_LIST_BIT(c); + had_char_class = 1; last = -1; continue; @@ -1499,12 +1506,14 @@ re_compile_pattern(pattern, size, bufp) SET_LIST_BIT(c); if (current_mbctype) set_list_bits(0x80, 0xffffffff, b); + had_char_class = 1; last = -1; continue; case 'd': for (c = '0'; c <= '9'; c++) SET_LIST_BIT(c); + had_char_class = 1; last = -1; continue; @@ -1514,6 +1523,7 @@ re_compile_pattern(pattern, size, bufp) SET_LIST_BIT(c); if (current_mbctype) set_list_bits(0x80, 0xffffffff, b); + had_char_class = 1; last = -1; continue; |