diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-08-31 11:24:44 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-08-31 11:24:44 +0000 |
commit | 5b5e4a6fc1e2829e6a2e1fb41986e951070646c7 (patch) | |
tree | edc5c2dd23e5782b76695b8e22b5f67a4fbdbadf /util.c | |
parent | 54af80844fbcf132f85e9275673eaa66b72da996 (diff) | |
download | ruby-5b5e4a6fc1e2829e6a2e1fb41986e951070646c7.tar.gz |
* file.c (test_identical, rb_file_s_truncate): use RSTRING_PTR and
RSTRING_STR.
* io.c (pipe_open, rb_io_reopen): ditto.
* process.c (proc_spawn_n, rb_spawn): ditto.
* util.c (ruby_add_suffix): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -156,26 +156,26 @@ ruby_add_suffix(VALUE str, const char *suffix) long slen; char buf[1024]; - if (RSTRING(str)->len > 1000) + if (RSTRING_LEN(str) > 1000) rb_fatal("Cannot do inplace edit on long filename (%ld characters)", - RSTRING(str)->len); + RSTRING_LEN(str)); #if defined(DJGPP) || defined(__CYGWIN32__) || defined(_WIN32) /* Style 0 */ - slen = RSTRING(str)->len; + slen = RSTRING_LEN(str); rb_str_cat(str, suffix, extlen); #if defined(DJGPP) if (_USE_LFN) return; #else - if (valid_filename(RSTRING(str)->ptr)) return; + if (valid_filename(RSTRING_PTR(str))) return; #endif /* Fooey, style 0 failed. Fix str before continuing. */ - RSTRING(str)->ptr[RSTRING(str)->len = slen] = '\0'; + rb_str_resize(str, slen); #endif slen = extlen; - t = buf; baselen = 0; s = RSTRING(str)->ptr; + t = buf; baselen = 0; s = RSTRING_PTR(str); while ((*t = *s) && *s != '.') { baselen++; if (*s == '\\' || *s == '/') baselen = 0; @@ -213,7 +213,7 @@ fallback: (void)memcpy(p, strEQ(ext, suffix1) ? suffix2 : suffix1, 5); } rb_str_resize(str, strlen(buf)); - memcpy(RSTRING(str)->ptr, buf, RSTRING(str)->len); + memcpy(RSTRING_PTR(str), buf, RSTRING_LEN(str)); } #if defined(__CYGWIN32__) || defined(_WIN32) |