summaryrefslogtreecommitdiffstats
path: root/dir.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-06-09 06:11:10 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-06-09 06:11:10 +0000
commitd7233ef103fae4f7530986d7aae14b6ff1d0cefd (patch)
tree608f20a0865383dd404958bda2d2378f3412ce54 /dir.c
parent669c9f14f0b6d09c8c50898bbfb9d76c619091c9 (diff)
downloadruby-d7233ef103fae4f7530986d7aae14b6ff1d0cefd.tar.gz
ruby-d7233ef103fae4f7530986d7aae14b6ff1d0cefd.tar.xz
ruby-d7233ef103fae4f7530986d7aae14b6ff1d0cefd.zip
* dir.c (sys_warning): get rid of type-punning function cast.
* dir.c (ruby_glob0): get rid of possible overflow. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/dir.c b/dir.c
index 7ded65420..e0be174f6 100644
--- a/dir.c
+++ b/dir.c
@@ -910,15 +910,16 @@ dir_s_rmdir(VALUE obj, VALUE dir)
return INT2FIX(0);
}
-static void
-sys_warning_1(const char* mesg)
+static VALUE
+sys_warning_1(VALUE mesg)
{
- rb_sys_warning("%s", mesg);
+ rb_sys_warning("%s", (const char *)mesg);
+ return Qnil;
}
-#define GLOB_VERBOSE (1UL << (sizeof(int) * CHAR_BIT - 1))
+#define GLOB_VERBOSE (1U << (sizeof(int) * CHAR_BIT - 1))
#define sys_warning(val) \
- (void)((flags & GLOB_VERBOSE) && rb_protect((VALUE (*)(VALUE))sys_warning_1, (VALUE)(val), 0))
+ (void)((flags & GLOB_VERBOSE) && rb_protect(sys_warning_1, (VALUE)(val), 0))
#define GLOB_ALLOC(type) (type *)malloc(sizeof(type))
#define GLOB_ALLOC_N(type, n) (type *)malloc(sizeof(type) * (n))
@@ -1383,7 +1384,7 @@ ruby_glob0(const char *path, int flags, ruby_glob_func *func, VALUE arg, rb_enco
struct glob_pattern *list;
const char *root, *start;
char *buf;
- int n;
+ size_t n;
int status;
start = root = path;