* dln.c (init_funcname_len, dln_find_exe_r, dln_find_file_r): use

size_t.

* file.c (rb_stat_inspect, file_expand_path): ditto.

* util.c (ruby_qsort): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-03-14 01:56:15 +00:00
Родитель 2e498843b6
Коммит 0164396029
5 изменённых файлов: 22 добавлений и 13 удалений

Просмотреть файл

@ -1,3 +1,12 @@
Sat Mar 14 10:56:13 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* dln.c (init_funcname_len, dln_find_exe_r, dln_find_file_r): use
size_t.
* file.c (rb_stat_inspect, file_expand_path): ditto.
* util.c (ruby_qsort): ditto.
Sat Mar 14 10:39:13 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/mkmf.rb (CXX_EXT): checks for case-sensitive filesystem with

14
dln.c
Просмотреть файл

@ -98,12 +98,12 @@ char *getenv();
# endif
#endif
static int
static size_t
init_funcname_len(char **buf, const char *file)
{
char *p;
const char *slash;
int len;
size_t len;
/* Load the file as an object one */
for (slash = file-1; *file; file++) /* Find position of last '/' */
@ -121,7 +121,7 @@ init_funcname_len(char **buf, const char *file)
}
#define init_funcname(buf, file) do {\
int len = init_funcname_len(buf, file);\
size_t len = init_funcname_len(buf, file);\
char *tmp = ALLOCA_N(char, len+1);\
if (!tmp) {\
free(*buf);\
@ -1478,7 +1478,7 @@ dln_load(const char *file)
static char *dln_find_1(const char *fname, const char *path, char *buf, size_t size, int exe_flag);
char *
dln_find_exe_r(const char *fname, const char *path, char *buf, int size)
dln_find_exe_r(const char *fname, const char *path, char *buf, size_t size)
{
if (!path) {
path = getenv(PATH_ENV);
@ -1495,7 +1495,7 @@ dln_find_exe_r(const char *fname, const char *path, char *buf, int size)
}
char *
dln_find_file_r(const char *fname, const char *path, char *buf, int size)
dln_find_file_r(const char *fname, const char *path, char *buf, size_t size)
{
if (!path) path = ".";
return dln_find_1(fname, path, buf, size, 0);
@ -1586,7 +1586,7 @@ dln_find_1(const char *fname, const char *path, char *fbuf, size_t size,
#undef RETURN_IF
for (dp = path;; dp = ++ep) {
register int l;
register size_t l;
/* extract a component */
ep = strchr(dp, PATH_SEP[0]);
@ -1659,7 +1659,7 @@ dln_find_1(const char *fname, const char *path, char *fbuf, size_t size,
/* end of __EMX__ or _WIN32 */
#endif
};
int j;
size_t j;
needs_extension:
for (j = 0; j < sizeof(extension) / sizeof(extension[0]); j++) {

4
dln.h
Просмотреть файл

@ -30,8 +30,8 @@
DEPRECATED(char *dln_find_exe(const char*,const char*));
DEPRECATED(char *dln_find_file(const char*,const char*));
char *dln_find_exe_r(const char*,const char*,char*,int);
char *dln_find_file_r(const char*,const char*,char*,int);
char *dln_find_exe_r(const char*,const char*,char*,size_t);
char *dln_find_file_r(const char*,const char*,char*,size_t);
#ifdef USE_DLN_A_OUT
extern char *dln_argv0;

4
file.c
Просмотреть файл

@ -654,7 +654,7 @@ static VALUE
rb_stat_inspect(VALUE self)
{
VALUE str;
int i;
size_t i;
static const struct {
const char *name;
VALUE (*func)(VALUE);
@ -2664,7 +2664,7 @@ file_expand_path(VALUE fname, VALUE dname, int abs_mode, VALUE result)
{
const char *s, *b;
char *buf, *p, *pend, *root;
long buflen, dirlen;
size_t buflen, dirlen;
int tainted;
rb_encoding *extenc = 0;

4
util.c
Просмотреть файл

@ -437,11 +437,11 @@ typedef struct { char *LL, *RR; } stack_node; /* Stack structure for L,l,R,r */
((*cmp)(b,c,d)>0 ? b : ((*cmp)(a,c,d)<0 ? a : c)))
void
ruby_qsort(void* base, const int nel, const int size,
ruby_qsort(void* base, const size_t nel, const size_t size,
int (*cmp)(const void*, const void*, void*), void *d)
{
register char *l, *r, *m; /* l,r:left,right group m:median point */
register int t, eq_l, eq_r; /* eq_l: all items in left group are equal to S */
register size_t t, eq_l, eq_r; /* eq_l: all items in left group are equal to S */
char *L = base; /* left end of curren region */
char *R = (char*)base + size*(nel-1); /* right end of current region */
int chklim = 63; /* threshold of ordering element check */