git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2000-08-07 05:05:04 +00:00
Родитель 14fe04bdac
Коммит c67251edb4
23 изменённых файлов: 244 добавлений и 83 удалений

Просмотреть файл

@ -1,3 +1,7 @@
Mon Aug 7 13:59:12 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* regex.c (re_match): check for stack depth was needed.
Sat Aug 5 16:43:43 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
* djgpp/*: convert DOS line endings to UNIX style.
@ -8,6 +12,26 @@ Sat Aug 5 16:43:43 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
* lib/ftools.rb (move): typo. not `tpath', but `to'.
Fri Aug 4 23:26:48 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* eval.c (proc_call): gives warning if a block is supplied.
* eval.c (rb_eval): no warning for discarding if an alias for the
method is already made.
Fri Aug 4 16:32:29 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* array.c (rb_ary_reject_bang): returns nil if no element removed.
* hash.c (rb_hash_reject_bang): returns nil if no element removed.
Thu Aug 3 19:44:26 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* eval.c (rb_thread_fd_writable): should return integer value.
* array.c (rb_ary_assoc): search array element whose length is
longer than 0 (not 1).
Wed Aug 2 18:27:47 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* eval.c (rb_thread_wait_fd): prohibit thread context switch

15
array.c
Просмотреть файл

@ -1121,7 +1121,7 @@ rb_ary_slice_bang(argc, argv, ary)
}
static VALUE
rb_ary_delete_if(ary)
rb_ary_reject_bang(ary)
VALUE ary;
{
long i1, i2;
@ -1134,11 +1134,20 @@ rb_ary_delete_if(ary)
}
i2++;
}
if (RARRAY(ary)->len == i2) return Qnil;
RARRAY(ary)->len = i2;
return ary;
}
static VALUE
rb_ary_delete_if(ary)
VALUE ary;
{
rb_ary_reject_bang(ary);
return ary;
}
static VALUE
rb_ary_replace_m(ary, ary2)
VALUE ary, ary2;
@ -1274,7 +1283,7 @@ rb_ary_assoc(ary, key)
p = RARRAY(ary)->ptr; pend = p + RARRAY(ary)->len;
while (p < pend) {
if (TYPE(*p) == T_ARRAY
&& RARRAY(*p)->len > 1
&& RARRAY(*p)->len > 0
&& rb_equal(RARRAY(*p)->ptr[0], key))
return *p;
p++;
@ -1626,7 +1635,7 @@ Init_Array()
rb_define_method(rb_cArray, "delete", rb_ary_delete, 1);
rb_define_method(rb_cArray, "delete_at", rb_ary_delete_at_m, 1);
rb_define_method(rb_cArray, "delete_if", rb_ary_delete_if, 0);
rb_define_method(rb_cArray, "reject!", rb_ary_delete_if, 0);
rb_define_method(rb_cArray, "reject!", rb_ary_reject_bang, 0);
rb_define_method(rb_cArray, "replace", rb_ary_replace_m, 1);
rb_define_method(rb_cArray, "clear", rb_ary_clear, 0);
rb_define_method(rb_cArray, "fill", rb_ary_fill, -1);

Просмотреть файл

@ -223,7 +223,7 @@ AC_FUNC_MEMCMP
AC_REPLACE_FUNCS(dup2 memmove mkdir strcasecmp strncasecmp strerror strftime\
strchr strstr strtoul crypt flock vsnprintf\
isinf isnan finite)
AC_CHECK_FUNCS(fmod killpg drand48 random wait4 waitpid syscall getcwd\
AC_CHECK_FUNCS(fmod killpg drand48 random wait4 waitpid syscall getcwd chroot\
truncate chsize times utimes fcntl lockf setitimer pause\
setruid seteuid setreuid setrgid setegid setregid\
getpgrp setpgrp getpgid setpgid getgroups getpriority\
@ -861,6 +861,7 @@ esac
AC_SUBST(LIBRUBY_LDSHARED)
AC_SUBST(LIBRUBY_DLDFLAGS)
AC_SUBST(RUBY_INSTALL_NAME)
AC_SUBST(RUBY_SO_NAME)
AC_SUBST(LIBRUBY_A)
AC_SUBST(LIBRUBY_SO)
AC_SUBST(LIBRUBY_ALIASES)

Просмотреть файл

@ -14,19 +14,20 @@ else
endif
WPROGRAM = $(RUBYW_INSTALL_NAME)$(EXEEXT)
RUBYDEF = $(RUBY_INSTALL_NAME).def
SOLIBS := $(RUBY_INSTALL_NAME).dll.res.o $(SOLIBS)
RUBY_SO_NAME = $(LIBRUBY_SO:.dll=)
SOLIBS := $(RUBY_SO_NAME).res.o $(SOLIBS)
EXTOBJS += $(@:$(EXEEXT)=.res.o)
$(LIBRUBY_SO): $(RUBYDEF) $(RUBY_INSTALL_NAME).dll.res.o
$(LIBRUBY_SO): $(RUBYDEF) $(RUBY_SO_NAME).res.o
$(LIBRUBY): $(LIBRUBY_SO)
%.res.o: %.rc
@WINDRES@ --include-dir . --include-dir $(<D) --include-dir $(srcdir)/win32 $< $@
$(RUBY_INSTALL_NAME).rc $(RUBYW_INSTALL_NAME).rc $(RUBY_INSTALL_NAME).dll.rc: rbconfig.rb
$(RUBY_INSTALL_NAME).rc $(RUBYW_INSTALL_NAME).rc $(RUBY_SO_NAME).rc: rbconfig.rb
@@MINIRUBY@ $(srcdir)/win32/resource.rb \
-ruby_name=$(RUBY_INSTALL_NAME) -rubyw_name=$(RUBYW_INSTALL_NAME) \
-so_name=$(RUBY_INSTALL_NAME).dll \
-so_name=$(RUBY_SO_NAME) \
. $(icondirs) $(srcdir)/win32
$(PROGRAM): $(RUBY_INSTALL_NAME).res.o

2
dir.c
Просмотреть файл

@ -433,7 +433,7 @@ static VALUE
dir_s_chroot(dir, path)
VALUE dir, path;
{
#if !defined(DJGPP) && !defined(NT) && !defined(__human68k__) && !defined(__BEOS__) && !defined(__EMX__) && !defined(riscos)
#if defined(HAVE_CHROOT) && !defined(__CHECKER__)
rb_secure(2);
Check_SafeStr(path);

77
djgpp/config.status Normal file
Просмотреть файл

@ -0,0 +1,77 @@
/^SHELL/s,/bin/sh,$(COMPSEC),
s%@srcdir@%.%g
s%@top_srcdir@%..%
s%@CFLAGS@%-O2%g
s%@CPPFLAGS@%%g
s%@CXXFLAGS@%%g
s%@LDFLAGS@%%g
s%@LIBS@%-lm %g
s%@exec_prefix@%${prefix}%g
s%@prefix@%/usr/local%g
s%@program_transform_name@%s,x,x,%g
s%@bindir@%${exec_prefix}/bin%g
s%@sbindir@%${exec_prefix}/sbin%g
s%@libexecdir@%${exec_prefix}/libexec%g
s%@datadir@%${prefix}/share%g
s%@sysconfdir@%${prefix}/etc%g
s%@sharedstatedir@%${prefix}/com%g
s%@localstatedir@%${prefix}/var%g
s%@libdir@%${exec_prefix}/lib%g
s%@includedir@%${prefix}/include%g
s%@oldincludedir@%/usr/include%g
s%@infodir@%${prefix}/info%g
s%@mandir@%${prefix}/man%g
s%@host@%i386-pc-msdosdjgpp%g
s%@host_alias@%i386-msdosdjgpp%g
s%@host_cpu@%i386%g
s%@host_vendor@%pc%g
s%@host_os@%msdosdjgpp%g
s%@CC@%gcc%g
s%@CPP@%gcc -E%g
s%@YACC@%bison -y%g
s%@RANLIB@%ranlib%g
s%@AR@%ar%g
s%@INSTALL_PROGRAM@%${INSTALL}%g
s%@INSTALL_DATA@%${INSTALL} -m 644%g
s%@SET_MAKE@%%g
s%@LIBOBJS@% crypt.o flock.o vsnprintf.o%g
s%@ALLOCA@%%g
s%@DEFAULT_KCODE@%%g
s%@EXEEXT@%.exe%g
s%@OBJEXT@%o%g
s%@XLDFLAGS@%%g
s%@DLDFLAGS@%%g
s%@STATIC@%%g
s%@CCDLFLAGS@%%g
s%@LDSHARED@%ld%g
s%@DLEXT@%o%g
s%@STRIP@%strip%g
s%@EXTSTATIC@%%g
s%@binsuffix@%.exe%g
s%@setup@%Setup.dj%g
s%@LIBRUBY@%libruby.a%g
s%@LIBRUBY_A@%libruby.a%g
s%@LIBRUBYARG@%libruby.a%g
s%@LIBRUBY_SO@%%g
s%@SOLIBS@%%g
s%@arch@%i386-msdosdjgpp%g
;s%/bin/rm%rm%
s%@DLDLIBS@%-lc%g
s%@PREP@%%
s%@RUBY_INSTALL_NAME@%ruby%g
s%@RUBY_SO_NAME@%%g
s%@arch@%i386-msdosdjgpp%g
s%@sitedir@%${prefix}/lib/ruby/site_ruby%g
s%@MINIRUBY@%./miniruby%
s%@archlib@%/usr/local/lib/ruby/i386-msdosdjgpp%
;s%|| true%%
;/\/dev\/null/ {
;s,/dev/null 2>&1, nul,
;s,2> /dev/null,,
;}
;/^config.status/ {
; N;N;N;N;N;d
;}
;s%y\.tab\.c%y_tab.c%
/^,THIS_IS_DUMMY_PATTERN_/i\
ac_given_srcdir=.

6
dln.c
Просмотреть файл

@ -14,6 +14,12 @@
#include "defines.h"
#include "dln.h"
#ifdef __CHECKER__
#undef HAVE_DLOPEN
#undef USE_DLN_A_OUT
#undef USE_DLN_DLOPEN
#endif
char *dln_argv0;
void rb_loaderror();

18
eval.c
Просмотреть файл

@ -1516,6 +1516,7 @@ rb_alias(klass, name, def)
print_undef(klass, def);
}
body = orig->nd_body;
orig->nd_cnt++;
if (nd_type(body) == NODE_FBODY) { /* was alias */
def = body->nd_mid;
origin = body->nd_orig;
@ -1793,7 +1794,7 @@ static VALUE
rb_obj_is_block(block)
VALUE block;
{
if (TYPE(block) == T_DATA && RDATA(block)->dfree == blk_free) {
if (TYPE(block) == T_DATA && RDATA(block)->dfree == (RUBY_DATA_FUNC)blk_free) {
return Qtrue;
}
return Qfalse;
@ -2792,7 +2793,7 @@ rb_eval(self, n)
frozen_class_p(ruby_class);
body = search_method(ruby_class, node->nd_mid, &origin);
if (body){
if (RTEST(ruby_verbose) && ruby_class == origin) {
if (RTEST(ruby_verbose) && ruby_class == origin && body->nd_cnt == 0) {
rb_warning("discarding old %s", rb_id2name(node->nd_mid));
}
rb_clear_cache_by_id(node->nd_mid);
@ -5932,6 +5933,12 @@ proc_call(proc, args)
volatile int orphan;
volatile int safe = ruby_safe_level;
if (rb_block_given_p()) {
rb_warning("block for %s#%s is useless",
rb_class2name(CLASS_OF(proc)),
rb_id2name(ruby_frame->last_func));
}
Data_Get_Struct(proc, struct BLOCK, data);
orphan = blk_orphan(data);
@ -6601,7 +6608,7 @@ static rb_thread_t
rb_thread_check(data)
VALUE data;
{
if (TYPE(data) != T_DATA || RDATA(data)->dfree != thread_free) {
if (TYPE(data) != T_DATA || RDATA(data)->dfree != (RUBY_DATA_FUNC)thread_free) {
rb_raise(rb_eTypeError, "wrong argument type %s (expected Thread)",
rb_class2name(CLASS_OF(data)));
}
@ -7089,7 +7096,9 @@ rb_thread_wait_fd(fd)
int fd;
{
if (curr_thread == curr_thread->next) return;
#if 0
if (ruby_in_compile) return;
#endif
curr_thread->status = THREAD_STOPPED;
curr_thread->fd = fd;
@ -7101,7 +7110,7 @@ int
rb_thread_fd_writable(fd)
int fd;
{
if (curr_thread == curr_thread->next) return;
if (curr_thread == curr_thread->next) return Qtrue;
curr_thread->status = THREAD_STOPPED;
FD_ZERO(&curr_thread->readfds);
@ -7111,6 +7120,7 @@ rb_thread_fd_writable(fd)
curr_thread->fd = fd+1;
curr_thread->wait_for = WAIT_SELECT;
rb_thread_schedule();
return Qfalse;
}
void

6
file.c
Просмотреть файл

@ -1022,7 +1022,7 @@ rb_file_chown(obj, owner, group)
struct timeval rb_time_timeval();
#ifdef HAVE_UTIMES
#if defined(HAVE_UTIMES) && !defined(__CHECKER__)
static void
utime_internal(path, tvp)
@ -1504,7 +1504,7 @@ rb_file_truncate(obj, len)
# define LOCK_UN 8
# endif
#if defined(EWOULDBLOCK)
#if defined(EWOULDBLOCK) && 0
static int
rb_thread_flock(fd, op, fptr)
int fd, op;
@ -1535,6 +1535,7 @@ rb_file_flock(obj, operation)
VALUE obj;
VALUE operation;
{
#ifndef __CHECKER__
OpenFile *fptr;
rb_secure(2);
@ -1551,6 +1552,7 @@ rb_file_flock(obj, operation)
#endif
rb_sys_fail(fptr->path);
}
#endif
return INT2FIX(0);
}
#undef flock

14
gc.c
Просмотреть файл

@ -278,15 +278,11 @@ rb_newobj()
{
VALUE obj;
if (freelist) {
retry:
obj = (VALUE)freelist;
freelist = freelist->as.free.next;
return obj;
}
rb_gc();
if (!freelist) rb_gc();
goto retry;
obj = (VALUE)freelist;
freelist = freelist->as.free.next;
return obj;
}
VALUE
@ -649,8 +645,6 @@ rb_gc_mark(ptr)
}
}
#define MIN_FREE_OBJ 512
static void obj_free _((VALUE));
static void

26
hash.c
Просмотреть файл

@ -456,7 +456,16 @@ rb_hash_delete_if(hash)
{
rb_hash_modify(hash);
rb_hash_foreach(hash, delete_if_i, 0);
return hash;
}
VALUE
rb_hash_reject_bang(hash)
VALUE hash;
{
int n = RHASH(hash)->tbl->num_entries;
rb_hash_delete_if(hash);
if (n == RHASH(hash)->tbl->num_entries) return Qnil;
return hash;
}
@ -1211,11 +1220,11 @@ env_each(hash)
}
static VALUE
env_delete_if()
env_reject_bang()
{
volatile VALUE keys;
VALUE *ptr;
int len;
int len, del = 0;
rb_secure(4);
keys = env_keys();
@ -1227,10 +1236,19 @@ env_delete_if()
if (!NIL_P(val)) {
if (RTEST(rb_yield(rb_assoc_new(*ptr, val)))) {
env_delete(Qnil, *ptr);
del++;
}
}
ptr++;
}
if (del == 0) return Qnil;
return envtbl;
}
static VALUE
env_delete_if()
{
env_reject_bang();
return envtbl;
}
@ -1425,8 +1443,8 @@ Init_Hash()
rb_define_method(rb_cHash,"shift", rb_hash_shift, 0);
rb_define_method(rb_cHash,"delete", rb_hash_delete, 1);
rb_define_method(rb_cHash,"delete_if", rb_hash_delete_if, 0);
rb_define_method(rb_cHash,"reject!", rb_hash_delete_if, 0);
rb_define_method(rb_cHash,"reject", rb_hash_reject, 0);
rb_define_method(rb_cHash,"reject!", rb_hash_reject_bang, 0);
rb_define_method(rb_cHash,"clear", rb_hash_clear, 0);
rb_define_method(rb_cHash,"invert", rb_hash_invert, 0);
rb_define_method(rb_cHash,"update", rb_hash_update, 1);
@ -1454,8 +1472,8 @@ Init_Hash()
rb_define_singleton_method(envtbl,"each_value", env_each_value, 0);
rb_define_singleton_method(envtbl,"delete", env_delete_m, 1);
rb_define_singleton_method(envtbl,"delete_if", env_delete_if, 0);
rb_define_singleton_method(envtbl,"reject!", env_delete_if, 0);
rb_define_singleton_method(envtbl,"reject", env_reject, 0);
rb_define_singleton_method(envtbl,"reject!", env_reject_bang, 0);
rb_define_singleton_method(envtbl,"to_s", env_to_s, 0);
rb_define_singleton_method(envtbl,"rehash", env_none, 0);
rb_define_singleton_method(envtbl,"to_a", env_to_a, 0);

4
io.c
Просмотреть файл

@ -1450,8 +1450,9 @@ pipe_del_fptr(fptr)
}
}
#if defined (NT) || defined(DJGPP) || defined(__CYGWIN__) || defined(__human68k__)
static void
pipe_atexit()
pipe_atexit _((void))
{
struct pipe_list *list = pipe_list;
struct pipe_list *tmp;
@ -1462,6 +1463,7 @@ pipe_atexit()
list = tmp;
}
}
#endif
static void
pipe_finalize(fptr)

Просмотреть файл

@ -125,12 +125,12 @@ class Complex < Numeric
def / (other)
if other.kind_of?(Complex)
self * other.conjugate / other.abs2
self*other.conjugate/other.abs2
elsif Complex.generic?(other)
Complex(@real / other, @image / other)
Complex(@real/other, @image/other)
else
x , y = other.coerce(self)
x / y
x, y = other.coerce(self)
x/y
end
end
@ -171,8 +171,8 @@ class Complex < Numeric
r, theta = polar
Complex.polar(r.power!(other), theta * other)
else
x , y = other.coerce(self)
x / y
x, y = other.coerce(self)
x/y
end
end

Просмотреть файл

@ -10,7 +10,7 @@ SCRIPT_LINES__ = {} unless defined? SCRIPT_LINES__
require 'tracer'
class Tracer
def Tracer.trace_func(*vars)
Single.trace_func *vars
Single.trace_func(*vars)
end
end
@ -216,7 +216,7 @@ class DEBUGGER__
@frames[0] = [binding, file, line, id]
display_expressions(binding)
while input = readline("(rdb:%d) "%thnum(), true)
catch (:debug_error) do
catch(:debug_error) do
if input == ""
input = DEBUG_LAST_CMD[0]
stdout.print input, "\n"

Просмотреть файл

@ -21,13 +21,13 @@ if $DEBUG
end
def Thread.exclusive
_old = Thread.critical
begin
Thread.critical = true
r = yield
return yield
ensure
Thread.critical = false
Thread.critical = _old
end
r
end
class Mutex

Просмотреть файл

@ -574,7 +574,7 @@ void
rb_syswait(pid)
int pid;
{
RETSIGTYPE (*hfunc)(), (*qfunc)(), (*ifunc)();
RETSIGTYPE (*hfunc)_((int)), (*qfunc)_((int)), (*ifunc)_((int));
int status;
int i;
@ -817,7 +817,7 @@ static VALUE
proc_getpgid(obj, pid)
VALUE obj, pid;
{
#ifdef HAVE_GETPGID
#if defined(HAVE_GETPGID) && !defined(__CHECKER__)
int i;
i = getpgid(NUM2INT(pid));

Просмотреть файл

@ -3964,7 +3964,7 @@ re_match(bufp, string_arg, size, pos, regs)
because didn't fail. Also remove the register information
put on by the on_failure_jump. */
case finalize_jump:
if (stackp[-2] == d) {
if (stackp > stackb && stackp[-2] == d) {
p = stackp[-3];
POP_FAILURE_POINT();
continue;
@ -3981,7 +3981,7 @@ re_match(bufp, string_arg, size, pos, regs)
case jump:
nofinalize:
EXTRACT_NUMBER_AND_INCR(mcnt, p);
if (mcnt < 0 && stackp > stackb && stackp[-2] == d) /* avoid infinit loop */
if (mcnt < 0 && stackp > stackb && stackp[-2] == d) /* avoid infinite loop */
goto fail;
p += mcnt;
continue;
@ -4072,7 +4072,7 @@ re_match(bufp, string_arg, size, pos, regs)
case finalize_push:
POP_FAILURE_POINT();
EXTRACT_NUMBER_AND_INCR(mcnt, p);
if (mcnt < 0 && stackp[-2] == d) /* avoid infinit loop */
if (mcnt < 0 && stackp > stackb && stackp[-2] == d) /* avoid infinite loop */
goto fail;
PUSH_FAILURE_POINT(p + mcnt, d);
stackp[-1] = NON_GREEDY;

Просмотреть файл

@ -282,7 +282,7 @@ rb_gc_mark_trap_list()
void
posix_signal(signum, handler)
int signum;
RETSIGTYPE (*handler)();
RETSIGTYPE (*handler)_((int));
{
struct sigaction sigact;
@ -336,6 +336,7 @@ signal_exec(sig)
}
}
static RETSIGTYPE sighandle _((int));
static RETSIGTYPE
sighandle(sig)
int sig;
@ -360,6 +361,7 @@ sighandle(sig)
}
#ifdef SIGBUS
static RETSIGTYPE sigbus _((int));
static RETSIGTYPE
sigbus(sig)
int sig;
@ -369,6 +371,7 @@ sigbus(sig)
#endif
#ifdef SIGSEGV
static RETSIGTYPE sigsegv _((int));
static RETSIGTYPE
sigsegv(sig)
int sig;
@ -420,8 +423,10 @@ static sigset_t trap_last_mask;
static int trap_last_mask;
# endif
static RETSIGTYPE sigexit _((int));
static RETSIGTYPE
sigexit()
sigexit(sig)
int sig;
{
rb_exit(0);
}
@ -430,7 +435,7 @@ static VALUE
trap(arg)
struct trap_arg *arg;
{
RETSIGTYPE (*func)();
RETSIGTYPE (*func)_((int));
VALUE command, old;
int sig;
char *s;

Просмотреть файл

@ -97,7 +97,12 @@ rb_str_new4(orig)
VALUE orig;
{
if (OBJ_FROZEN(orig)) return orig;
if (RSTRING(orig)->orig && !FL_TEST(orig, STR_NO_ORIG)) {
if (RSTRING(orig)->orig) {
if (FL_TEST(orig, STR_NO_ORIG)) {
orig = rb_str_new(RSTRING(orig)->ptr, RSTRING(orig)->len);
OBJ_FREEZE(orig);
return orig;
}
OBJ_FREEZE(RSTRING(orig)->orig);
return RSTRING(orig)->orig;
}
@ -349,24 +354,32 @@ rb_str_substr(str, beg, len)
return str2;
}
static int
str_independent(str)
VALUE str;
{
if (OBJ_FROZEN(str)) rb_error_frozen("string");
if (!OBJ_TAINTED(str) && rb_safe_level() >= 4)
rb_raise(rb_eSecurityError, "Insecure: can't modify string");
if (!RSTRING(str)->orig || FL_TEST(str, STR_NO_ORIG)) return 1;
if (TYPE(RSTRING(str)->orig) != T_STRING) rb_bug("non string str->orig");
RSTRING(str)->orig = 0;
return 0;
}
void
rb_str_modify(str)
VALUE str;
{
char *ptr;
if (OBJ_FROZEN(str)) rb_error_frozen("string");
if (!OBJ_TAINTED(str) && rb_safe_level() >= 4)
rb_raise(rb_eSecurityError, "Insecure: can't modify string");
if (!RSTRING(str)->orig || FL_TEST(str, STR_NO_ORIG)) return;
if (TYPE(RSTRING(str)->orig) != T_STRING) abort();
if (str_independent(str)) return;
ptr = ALLOC_N(char, RSTRING(str)->len+1);
if (RSTRING(str)->ptr) {
memcpy(ptr, RSTRING(str)->ptr, RSTRING(str)->len);
}
ptr[RSTRING(str)->len] = 0;
RSTRING(str)->ptr = ptr;
RSTRING(str)->orig = 0;
}
VALUE
@ -1250,8 +1263,9 @@ str_gsub(argc, argv, str, bang)
}
rb_backref_set(match);
if (bang) {
rb_str_modify(str);
free(RSTRING(str)->ptr);
if (str_independent(str)) {
free(RSTRING(str)->ptr);
}
}
else {
NEWOBJ(dup, struct RString);
@ -1325,13 +1339,12 @@ rb_f_sub(argc, argv)
int argc;
VALUE *argv;
{
VALUE str = uscore_get();
VALUE dup = rb_str_dup(str);
VALUE str = rb_str_dup(uscore_get());
if (NIL_P(rb_str_sub_bang(argc, argv, dup)))
if (NIL_P(rb_str_sub_bang(argc, argv, str)))
return str;
rb_lastline_set(dup);
return dup;
rb_lastline_set(str);
return str;
}
static VALUE
@ -1347,13 +1360,12 @@ rb_f_gsub(argc, argv)
int argc;
VALUE *argv;
{
VALUE str = uscore_get();
VALUE dup = rb_str_dup(str);
VALUE str = rb_str_dup(uscore_get());
if (NIL_P(rb_str_gsub_bang(argc, argv, dup)))
if (NIL_P(rb_str_gsub_bang(argc, argv, str)))
return str;
rb_lastline_set(dup);
return dup;
rb_lastline_set(str);
return str;
}
static VALUE

Просмотреть файл

@ -1,4 +1,4 @@
#define RUBY_VERSION "1.5.5"
#define RUBY_RELEASE_DATE "2000-08-05"
#define RUBY_RELEASE_DATE "2000-08-07"
#define RUBY_VERSION_CODE 155
#define RUBY_RELEASE_CODE 20000805
#define RUBY_RELEASE_CODE 20000807

Просмотреть файл

@ -29,12 +29,12 @@ AUTOCONF = autoconf
prefix = /usr
CFLAGS = -nologo -DNT=1 -Zi -O2b2x -G5
CFLAGS = -nologo -DNT=1 -MDd -Zi
CPPFLAGS = -I$(srcdir) -I$(srcdir)/missing
LDFLAGS = $(CFLAGS) -Fm
XLDFLAGS =
#EXTLIBS =
LIBS = user32.lib advapi32.lib wsock32.lib $(EXTLIBS)
LIBS = RubyCRTD.lib user32.lib advapi32.lib ws2_32.lib $(EXTLIBS)
MISSING = crypt.obj alloca.obj win32.obj isinf.obj isnan.obj
LDSHARED =
DLDFLAGS =

Просмотреть файл

@ -1,12 +1,12 @@
s%@SHELL@%%g
s%@CFLAGS@%-nologo -DNT=1 -Zi -O2b2x -G5%g
s%@CFLAGS@%-nologo -DNT=1 -MDd -Zi%g
s%@CPPFLAGS@%%g
s%@CXXFLAGS@%%g
s%@FFLAGS@%%g
s%@DEFS@%
-DUSE_THREAD -DSIZEOF_INT=4 -DSIZEOF_SHORT=2 -DSIZEOF_LONG=4 -DSIZEOF_VOIDP=4 -DSIZEOF_FLOAT=4 -DSIZEOF_DOUBLE=8 -DHAVE_PROTOTYPES=1 -DHAVE_STDARG_PROTOTYPES=1 -DHAVE_STDLIB_H=1 -DHAVE_LIMITS_H=1 -DHAVE_FCNTL_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ST_RDEV=1 -DGETGROUPS_T=int -DRETSIGTYPE=void -DHAVE_ALLOCA=1 -DHAVE_FMOD=1 -DHAVE_WAITPID=1 -DHAVE_GETCWD=1 -DHAVE_CHSIZE=1 -DHAVE_GETGROUPS=1 -DHAVE_GETLOGIN=1 -DRSHIFT=\(x,y\)\ \(\(x\)\>\>y\) -DFILE_COUNT=_cnt -DDLEXT=\".so\" -DDLEXT2=\".dll\" -DRUBY_PLATFORM=\"i586-mswin32\" %g
s%@LDFLAGS@%-nologo -Ox%g
s%@LIBS@%user32.lib advapi32.lib wsock32.lib%g
s%@LDFLAGS@%-nologo -MDd -Zi%g
s%@LIBS@%RubyCRTD.lib user32.lib advapi32.lib ws2_32.lib%g
s%@exec_prefix@%${prefix}%g
s%@prefix@%%g
s%@program_transform_name@%s,x,x,%g
@ -40,7 +40,7 @@ s%@DEFAULT_KCODE@%%g
s%@EXEEXT@%.exe%g
s%@OBJEXT@%obj%g
s%@XLDFLAGS@%%g
s%@DLDFLAGS@%%g
s%@DLDFLAGS@%-MDd -Zi%g
s%@STATIC@%%g
s%@CCDLFLAGS@%-DIMPORT%g
s%@LDSHARED@%cl -LD%g
@ -59,10 +59,10 @@ s%@LIBRUBY_ALIASES@%%g
s%@LIBRUBY@%$(RUBY_SO_NAME).lib%g
s%@LIBRUBYARG@%$(topdir)/$(RUBY_SO_NAME).lib%g
s%@SOLIBS@%%g
s%@DLDLIBS@%%g
s%@DLDLIBS@%RubyCRTD.lib%g
s%@arch@%i586-mswin32%g
s%@sitedir@%${prefix}/lib/ruby/site_ruby%g
s%@configure_args@%--with-make-prog=nmake%g
s%@configure_args@%--with-make-prog=nmake --with-tcllib=tcl83 --with-tklib=tk83%g
s%@configure_input@%$configure_input%g
s%@srcdir@%$srcdir%g
s%@top_srcdir@%$top_srcdir%g

Просмотреть файл

@ -15,11 +15,11 @@ all: Makefile
all:; @echo type `nmake' to make ruby for mswin32.
Makefile:
@echo> $@ ### makefile for ruby $(OS) ###
@echo>> $@ srcdir = $(srcdir:\=/)
@echo>> $@ RUBY_INSTALL_NAME = ruby
@echo>> $@ RUBY_SO_NAME = $$(RUBY_INSTALL_NAME).$(OS)
@echo>> $@ !INCLUDE $$(srcdir)/win32/Makefile.sub
@echo ### makefile for ruby $(OS) ###> $@
@echo srcdir = $(srcdir:\=/)>> $@
@echo RUBY_INSTALL_NAME = ruby>> $@
@echo RUBY_SO_NAME = $$(RUBY_INSTALL_NAME).$(OS)>> $@
@echo !INCLUDE $$(srcdir)/win32/Makefile.sub>> $@
config.h config.status: $(srcdir)/win32/$$@.in
@copy $(srcdir:/=\)\win32\$@.in $@ > nul