summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
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 2c4616f2f0..811452bfb0 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())