summaryrefslogtreecommitdiff
path: root/pack.c
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-06 10:39:57 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-06 10:39:57 +0000
commit2b785b0f3e4f902e7de29a895d1f6ae0f10c3265 (patch)
treebc1801ecbd4d1e852a5ae0a0b8202a41c7ec933b /pack.c
parent23a434b3630b05781dc48e07582ed180d9661a6a (diff)
downloadruby-2b785b0f3e4f902e7de29a895d1f6ae0f10c3265.tar.gz
Merge changes from ruby_1_8 to reduce warnings and potentially improve
security. * mkconfig.rb: hide build path from rbconfig.rb. * util.c (ruby_strtod, dtoa): initialize more variables for error handling. * io.c (rscheck), marshal.c (w_nbyte, w_bytes, w_unique), (path2class, path2module): constified. * pack.c (pack_unpack), process.c (rb_syswait): suppress warnings. * suppress warnings on cygwin, mingw and mswin. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'pack.c')
-rw-r--r--pack.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/pack.c b/pack.c
index cf348947f1..b22a8348b2 100644
--- a/pack.c
+++ b/pack.c
@@ -1884,8 +1884,8 @@ pack_unpack(str, fmt)
case 'P':
if (sizeof(char *) <= send - s) {
+ VALUE tmp = Qnil;
char *t;
- VALUE tmp;
memcpy(&t, s, sizeof(char *));
s += sizeof(char *);
@@ -1915,9 +1915,6 @@ pack_unpack(str, fmt)
rb_raise(rb_eArgError, "non associated pointer");
}
}
- else {
- tmp = Qnil;
- }
rb_ary_push(ary, tmp);
}
break;
@@ -1929,7 +1926,7 @@ pack_unpack(str, fmt)
if (send - s < sizeof(char *))
break;
else {
- VALUE tmp;
+ VALUE tmp = Qnil;
char *t;
memcpy(&t, s, sizeof(char *));
@@ -1954,9 +1951,6 @@ pack_unpack(str, fmt)
rb_raise(rb_eArgError, "non associated pointer");
}
}
- else {
- tmp = Qnil;
- }
rb_ary_push(ary, tmp);
}
}