mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* string.c (rb_str_delete_bang): should check if str->ptr is 0.
* string.c (rb_str_squeeze_bang): ditto. * string.c (rb_str_count): ditto. * string.c (rb_str_lstrip_bang): ditto. * string.c (rb_str_rstrip_bang): ditto. * string.c (rb_str_intern): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c1454b3acb
commit
1a44a463af
4 changed files with 31 additions and 5 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
Wed Aug 28 15:00:29 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* string.c (rb_str_delete_bang): should check if str->ptr is 0.
|
||||
|
||||
* string.c (rb_str_squeeze_bang): ditto.
|
||||
|
||||
* string.c (rb_str_count): ditto.
|
||||
|
||||
* string.c (rb_str_lstrip_bang): ditto.
|
||||
|
||||
* string.c (rb_str_rstrip_bang): ditto.
|
||||
|
||||
* string.c (rb_str_intern): ditto.
|
||||
|
||||
Wed Aug 28 11:37:35 2002 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* win32/win32.h: define SIGINT and SIGKILL if not defined.
|
||||
|
|
|
@ -97,7 +97,8 @@ AC_PROG_GCC_TRADITIONAL
|
|||
|
||||
AC_PROG_YACC
|
||||
AC_CHECK_TOOL(RANLIB, ranlib, :)
|
||||
AC_CHECK_TOOL(AR, ar aal, ar)
|
||||
AC_CHECK_TOOL(AR, ar)
|
||||
AC_CHECK_PROGS(AR, ar aal, ar)
|
||||
|
||||
case "$target_os" in
|
||||
cygwin*|mingw*)
|
||||
|
|
15
string.c
15
string.c
|
@ -2133,6 +2133,7 @@ tr_trans(str, src, repl, sflag)
|
|||
rb_str_modify(str);
|
||||
StringValue(src);
|
||||
StringValue(repl);
|
||||
if (RSTRING(str)->len == 0 || !RSTRING(str)->ptr) return Qnil;
|
||||
trsrc.p = RSTRING(src)->ptr; trsrc.pend = trsrc.p + RSTRING(src)->len;
|
||||
if (RSTRING(src)->len >= 2 && RSTRING(src)->ptr[0] == '^') {
|
||||
cflag++;
|
||||
|
@ -2288,6 +2289,7 @@ rb_str_delete_bang(argc, argv, str)
|
|||
|
||||
rb_str_modify(str);
|
||||
s = t = RSTRING(str)->ptr;
|
||||
if (!s || RSTRING(str)->len == 0) return Qnil;
|
||||
send = s + RSTRING(str)->len;
|
||||
while (s < send) {
|
||||
if (squeez[*s & 0xff])
|
||||
|
@ -2342,8 +2344,8 @@ rb_str_squeeze_bang(argc, argv, str)
|
|||
}
|
||||
|
||||
rb_str_modify(str);
|
||||
|
||||
s = t = RSTRING(str)->ptr;
|
||||
if (!s || RSTRING(str)->len == 0) return Qnil;
|
||||
send = s + RSTRING(str)->len;
|
||||
save = -1;
|
||||
while (s < send) {
|
||||
|
@ -2412,6 +2414,7 @@ rb_str_count(argc, argv, str)
|
|||
}
|
||||
|
||||
s = RSTRING(str)->ptr;
|
||||
if (!s || RSTRING(str)->len == 0) return Qnil;
|
||||
send = s + RSTRING(str)->len;
|
||||
i = 0;
|
||||
while (s < send) {
|
||||
|
@ -2795,6 +2798,7 @@ rb_str_lstrip_bang(str)
|
|||
|
||||
rb_str_modify(str);
|
||||
s = RSTRING(str)->ptr;
|
||||
if (!s || RSTRING(str)->len == 0) return Qnil;
|
||||
e = t = s + RSTRING(str)->len;
|
||||
/* remove spaces at head */
|
||||
while (s < t && ISSPACE(*s)) s++;
|
||||
|
@ -2825,6 +2829,7 @@ rb_str_rstrip_bang(str)
|
|||
|
||||
rb_str_modify(str);
|
||||
s = RSTRING(str)->ptr;
|
||||
if (!s || RSTRING(str)->len == 0) return Qnil;
|
||||
e = t = s + RSTRING(str)->len;
|
||||
|
||||
/* remove trailing spaces */
|
||||
|
@ -2958,12 +2963,15 @@ rb_str_crypt(str, salt)
|
|||
{
|
||||
extern char *crypt();
|
||||
VALUE result;
|
||||
char *s;
|
||||
|
||||
StringValue(salt);
|
||||
if (RSTRING(salt)->len < 2)
|
||||
rb_raise(rb_eArgError, "salt too short(need >=2 bytes)");
|
||||
|
||||
result = rb_str_new2(crypt(RSTRING(str)->ptr, RSTRING(salt)->ptr));
|
||||
if (RSTRING(str)->ptr) s = RSTRING(str)->ptr;
|
||||
else s = "";
|
||||
result = rb_str_new2(crypt(s, RSTRING(salt)->ptr));
|
||||
OBJ_INFECT(result, str);
|
||||
OBJ_INFECT(result, salt);
|
||||
return result;
|
||||
|
@ -2975,6 +2983,9 @@ rb_str_intern(str)
|
|||
{
|
||||
ID id;
|
||||
|
||||
if (!RSTRING(str)->ptr || RSTRING(str)->len == 0) {
|
||||
rb_raise(rb_eArgError, "interning empty string");
|
||||
}
|
||||
if (strlen(RSTRING(str)->ptr) != RSTRING(str)->len)
|
||||
rb_raise(rb_eArgError, "string contains `\\0'");
|
||||
id = rb_intern(RSTRING(str)->ptr);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#define RUBY_VERSION "1.7.3"
|
||||
#define RUBY_RELEASE_DATE "2002-08-27"
|
||||
#define RUBY_RELEASE_DATE "2002-08-28"
|
||||
#define RUBY_VERSION_CODE 173
|
||||
#define RUBY_RELEASE_CODE 20020827
|
||||
#define RUBY_RELEASE_CODE 20020828
|
||||
|
|
Loading…
Reference in a new issue