mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
2000-03-15
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
31c55301e4
commit
0d3f4a92cf
6 changed files with 58 additions and 22 deletions
|
@ -1,3 +1,7 @@
|
|||
Wed Mar 15 13:12:39 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||
|
||||
* string.c (rb_str_chomp_bang): forgot to call rb_str_modify().
|
||||
|
||||
Mon Mar 13 16:12:13 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||
|
||||
* eval.c (block_pass): distinguish real orphan block and still
|
||||
|
|
19
configure
vendored
19
configure
vendored
|
@ -4933,6 +4933,25 @@ case "$target_os" in
|
|||
rhasody*)
|
||||
CFLAGS="$CFLAGS -pipe -no-precomp"
|
||||
;;
|
||||
osf*)
|
||||
if $without_gcc = "yes" ; then
|
||||
CFLAGS="$CFLAGS -ansi"
|
||||
else
|
||||
# compile something small: taint.c is fine for this.
|
||||
# the main point is the '-v' flag of 'cc'.
|
||||
case "`cc -v -I. -c main.c -o /tmp/main.o 2>&1`" in
|
||||
*/gemc_cc*) # we have the new DEC GEM CC
|
||||
CFLAGS="$CFLAGS -frpm d -ieee"
|
||||
;;
|
||||
*) # we have the old MIPS CC
|
||||
CFLAGS="$CFLAGS -oldc"
|
||||
;;
|
||||
esac
|
||||
# cleanup
|
||||
rm -f /tmp/main.o
|
||||
CFLAGS="$CFLAGS -std"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
|
19
configure.in
19
configure.in
|
@ -774,6 +774,25 @@ case "$target_os" in
|
|||
rhasody*)
|
||||
CFLAGS="$CFLAGS -pipe -no-precomp"
|
||||
;;
|
||||
osf*)
|
||||
if [ $without_gcc = "yes" ]; then
|
||||
CFLAGS="$CFLAGS -ansi"
|
||||
else
|
||||
# compile something small: taint.c is fine for this.
|
||||
# the main point is the '-v' flag of 'cc'.
|
||||
case "`cc -v -I. -c main.c -o /tmp/main.o 2>&1`" in
|
||||
*/gemc_cc*) # we have the new DEC GEM CC
|
||||
CFLAGS="$CFLAGS -frpm d -ieee"
|
||||
;;
|
||||
*) # we have the old MIPS CC
|
||||
CFLAGS="$CFLAGS -oldc"
|
||||
;;
|
||||
esac
|
||||
# cleanup
|
||||
rm -f /tmp/main.o
|
||||
CFLAGS="$CFLAGS -std"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -24,7 +24,7 @@ bindir = destdir+CONFIG["bindir"]
|
|||
libdir = destdir+CONFIG["libdir"]
|
||||
rubylibdir = destdir+CONFIG["prefix"]+"/lib/ruby"+version
|
||||
archlibdir = rubylibdir+arch
|
||||
sitelibdir = destdir+CONFIG["prefix"]+"/lib/site_ruby"+version
|
||||
sitelibdir = destdir+CONFIG["prefix"]+"/lib/ruby/site_ruby"+version
|
||||
sitearchlibdir = sitelibdir+arch
|
||||
mandir = destdir+CONFIG["mandir"] + "/man1"
|
||||
wdir = Dir.getwd
|
||||
|
|
32
string.c
32
string.c
|
@ -131,7 +131,7 @@ rb_str_become(str, str2)
|
|||
RSTRING(str)->orig = 0;
|
||||
return;
|
||||
}
|
||||
if ((!RSTRING(str)->orig||FL_TEST(str, STR_NO_ORIG))&&RSTRING(str)->ptr)
|
||||
if ((!RSTRING(str)->orig||FL_TEST(str,STR_NO_ORIG))&&RSTRING(str)->ptr)
|
||||
free(RSTRING(str)->ptr);
|
||||
RSTRING(str)->ptr = RSTRING(str2)->ptr;
|
||||
RSTRING(str)->len = RSTRING(str2)->len;
|
||||
|
@ -159,26 +159,17 @@ rb_obj_as_string(obj)
|
|||
return str;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
str_dup(str)
|
||||
VALUE str;
|
||||
{
|
||||
VALUE s;
|
||||
|
||||
if (TYPE(str) != T_STRING) str = rb_str_to_str(str);
|
||||
s = rb_str_new(RSTRING(str)->ptr, RSTRING(str)->len);
|
||||
if (OBJ_TAINTED(str)) OBJ_TAINT(s);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_str_dup(str)
|
||||
VALUE str;
|
||||
{
|
||||
if (TYPE(str) != T_STRING) str = rb_str_to_str(str);
|
||||
if (OBJ_FROZEN(str)) return rb_str_new3(str);
|
||||
if (FL_TEST(str, STR_NO_ORIG)) return str_dup(str);
|
||||
if (FL_TEST(str, STR_NO_ORIG)) {
|
||||
VALUE s = rb_str_new(RSTRING(str)->ptr, RSTRING(str)->len);
|
||||
OBJ_INFECT(s, str);
|
||||
return s;
|
||||
}
|
||||
if (RSTRING(str)->orig) return rb_str_new3(RSTRING(str)->orig);
|
||||
else {
|
||||
VALUE shadow;
|
||||
|
@ -343,12 +334,12 @@ rb_str_modify(str)
|
|||
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;
|
||||
ptr = RSTRING(str)->ptr;
|
||||
RSTRING(str)->ptr = ALLOC_N(char, RSTRING(str)->len+1);
|
||||
ptr = ALLOC_N(char, RSTRING(str)->len+1);
|
||||
if (RSTRING(str)->ptr) {
|
||||
memcpy(RSTRING(str)->ptr, ptr, RSTRING(str)->len);
|
||||
RSTRING(str)->ptr[RSTRING(str)->len] = 0;
|
||||
memcpy(ptr, RSTRING(str)->ptr, RSTRING(str)->len);
|
||||
}
|
||||
ptr[RSTRING(str)->len] = 0;
|
||||
RSTRING(str)->ptr = ptr;
|
||||
RSTRING(str)->orig = 0;
|
||||
}
|
||||
|
||||
|
@ -1221,6 +1212,7 @@ str_gsub(argc, argv, str, bang)
|
|||
else {
|
||||
NEWOBJ(dup, struct RString);
|
||||
OBJSETUP(dup, rb_cString, T_STRING);
|
||||
OBJ_INFECT(dup, str);
|
||||
str = (VALUE)dup;
|
||||
}
|
||||
RSTRING(str)->ptr = buf;
|
||||
|
@ -2362,6 +2354,7 @@ rb_str_chomp_bang(argc, argv, str)
|
|||
len--;
|
||||
}
|
||||
if (len < RSTRING(str)->len) {
|
||||
rb_str_modify(str);
|
||||
RSTRING(str)->len = len;
|
||||
RSTRING(str)->ptr[len] = '\0';
|
||||
return str;
|
||||
|
@ -2374,6 +2367,7 @@ rb_str_chomp_bang(argc, argv, str)
|
|||
if (p[len-1] == newline &&
|
||||
(rslen <= 1 ||
|
||||
memcmp(RSTRING(rs)->ptr, p+len-rslen, rslen) == 0)) {
|
||||
rb_str_modify(str);
|
||||
RSTRING(str)->len -= rslen;
|
||||
RSTRING(str)->ptr[RSTRING(str)->len] = '\0';
|
||||
return str;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#define RUBY_VERSION "1.5.3"
|
||||
#define RUBY_RELEASE_DATE "2000-03-13"
|
||||
#define RUBY_RELEASE_DATE "2000-03-15"
|
||||
#define RUBY_VERSION_CODE 153
|
||||
#define RUBY_RELEASE_CODE 20000313
|
||||
#define RUBY_RELEASE_CODE 20000315
|
||||
|
|
Loading…
Reference in a new issue