From 54af80844fbcf132f85e9275673eaa66b72da996 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 31 Aug 2006 10:47:44 +0000 Subject: * ruby.h (struct RString): embed small strings. (RSTRING_LEN): defined for accessing string members. (RSTRING_PTR): ditto. * string.c: use RSTRING_LEN and RSTRING_PTR. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- signal.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'signal.c') diff --git a/signal.c b/signal.c index 8e76090487..1a46bac910 100644 --- a/signal.c +++ b/signal.c @@ -242,7 +242,7 @@ rb_f_kill(int argc, VALUE *argv) goto str_signal; case T_STRING: - s = RSTRING(argv[0])->ptr; + s = RSTRING_PTR(argv[0]); if (s[0] == '-') { negative++; s++; @@ -263,7 +263,7 @@ rb_f_kill(int argc, VALUE *argv) str = rb_check_string_type(argv[0]); if (!NIL_P(str)) { - s = RSTRING(str)->ptr; + s = RSTRING_PTR(str); goto str_signal; } rb_raise(rb_eArgError, "bad signal type %s", @@ -574,28 +574,28 @@ trap(struct trap_arg *arg) command = rb_check_string_type(arg->cmd); if (!NIL_P(command)) { SafeStringValue(command); /* taint check */ - switch (RSTRING(command)->len) { + switch (RSTRING_LEN(command)) { case 0: func = SIG_IGN; break; case 7: - if (strncmp(RSTRING(command)->ptr, "SIG_IGN", 7) == 0) { + if (strncmp(RSTRING_PTR(command), "SIG_IGN", 7) == 0) { func = SIG_IGN; } - else if (strncmp(RSTRING(command)->ptr, "SIG_DFL", 7) == 0) { + else if (strncmp(RSTRING_PTR(command), "SIG_DFL", 7) == 0) { func = SIG_DFL; } - else if (strncmp(RSTRING(command)->ptr, "DEFAULT", 7) == 0) { + else if (strncmp(RSTRING_PTR(command), "DEFAULT", 7) == 0) { func = SIG_DFL; } break; case 6: - if (strncmp(RSTRING(command)->ptr, "IGNORE", 6) == 0) { + if (strncmp(RSTRING_PTR(command), "IGNORE", 6) == 0) { func = SIG_IGN; } break; case 4: - if (strncmp(RSTRING(command)->ptr, "EXIT", 4) == 0) { + if (strncmp(RSTRING_PTR(command), "EXIT", 4) == 0) { arg->cmd = Qundef; } break; @@ -620,7 +620,7 @@ trap(struct trap_arg *arg) goto str_signal; case T_STRING: - s = RSTRING(arg->sig)->ptr; + s = RSTRING_PTR(arg->sig); str_signal: if (strncmp("SIG", s, 3) == 0) -- cgit v1.2.3