1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* dir.c (sys_warning): get rid of type-punning function cast.

* dir.c (ruby_glob0): get rid of possible overflow.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-06-09 06:11:10 +00:00
parent a5488474c2
commit 11fd9224f7
2 changed files with 13 additions and 6 deletions

View file

@ -1,3 +1,9 @@
Tue Jun 9 15:11:07 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* dir.c (sys_warning): get rid of type-punning function cast.
* dir.c (ruby_glob0): get rid of possible overflow.
Tue Jun 9 10:58:48 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* Makefile.in, win32/Makefile.sub (RMALL): need for distclean-rdoc.

13
dir.c
View file

@ -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;