summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-07-13 04:38:01 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-07-13 04:38:01 +0000
commit35c6e6af5ba2c405a91dc6b9e4af833d0979ed22 (patch)
tree7f54dda0bcda0a58eb5229def03ce3015c98a2b5 /hash.c
parent71d408a6c3298b229c0f1d2ff7159ca410a4c612 (diff)
str2cstr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/hash.c b/hash.c
index 2c4616f..811452b 100644
--- a/hash.c
+++ b/hash.c
@@ -198,8 +198,9 @@ hash_s_new(argc, argv, klass)
hash->status = 0;
hash->tbl = 0; /* avoid GC crashing */
- rb_scan_args(argc, argv, "01", &sz);
- if (NIL_P(sz)) size = 0;
+ if (rb_scan_args(argc, argv, "01", &sz) == 0) {
+ size = 0;
+ }
else size = NUM2INT(sz);
hash->tbl = st_init_table_with_size(&objhash, size);
@@ -848,9 +849,9 @@ f_getenv(obj, name)
int len;
nam = str2cstr(name, &len);
- if (strlen(nam) != len)
- ArgError("Bad environment name");
-
+ if (strlen(nam) != len) {
+ ArgError("Bad environment variable name");
+ }
env = getenv(nam);
if (env) {
if (strcmp(nam, "PATH") == 0 && !env_path_tainted())