Skip to content

Commit 0164396

Browse files
committed
* 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
1 parent 2e49884 commit 0164396

File tree

5 files changed

+22
-13
lines changed

5 files changed

+22
-13
lines changed

ChangeLog

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
Sat Mar 14 10:56:13 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
2+
3+
* dln.c (init_funcname_len, dln_find_exe_r, dln_find_file_r): use
4+
size_t.
5+
6+
* file.c (rb_stat_inspect, file_expand_path): ditto.
7+
8+
* util.c (ruby_qsort): ditto.
9+
110
Sat Mar 14 10:39:13 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
211

312
* lib/mkmf.rb (CXX_EXT): checks for case-sensitive filesystem with

dln.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,12 @@ char *getenv();
9898
# endif
9999
#endif
100100

101-
static int
101+
static size_t
102102
init_funcname_len(char **buf, const char *file)
103103
{
104104
char *p;
105105
const char *slash;
106-
int len;
106+
size_t len;
107107

108108
/* Load the file as an object one */
109109
for (slash = file-1; *file; file++) /* Find position of last '/' */
@@ -121,7 +121,7 @@ init_funcname_len(char **buf, const char *file)
121121
}
122122

123123
#define init_funcname(buf, file) do {\
124-
int len = init_funcname_len(buf, file);\
124+
size_t len = init_funcname_len(buf, file);\
125125
char *tmp = ALLOCA_N(char, len+1);\
126126
if (!tmp) {\
127127
free(*buf);\
@@ -1478,7 +1478,7 @@ dln_load(const char *file)
14781478
static char *dln_find_1(const char *fname, const char *path, char *buf, size_t size, int exe_flag);
14791479

14801480
char *
1481-
dln_find_exe_r(const char *fname, const char *path, char *buf, int size)
1481+
dln_find_exe_r(const char *fname, const char *path, char *buf, size_t size)
14821482
{
14831483
if (!path) {
14841484
path = getenv(PATH_ENV);
@@ -1495,7 +1495,7 @@ dln_find_exe_r(const char *fname, const char *path, char *buf, int size)
14951495
}
14961496

14971497
char *
1498-
dln_find_file_r(const char *fname, const char *path, char *buf, int size)
1498+
dln_find_file_r(const char *fname, const char *path, char *buf, size_t size)
14991499
{
15001500
if (!path) path = ".";
15011501
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,
15861586
#undef RETURN_IF
15871587

15881588
for (dp = path;; dp = ++ep) {
1589-
register int l;
1589+
register size_t l;
15901590

15911591
/* extract a component */
15921592
ep = strchr(dp, PATH_SEP[0]);
@@ -1659,7 +1659,7 @@ dln_find_1(const char *fname, const char *path, char *fbuf, size_t size,
16591659
/* end of __EMX__ or _WIN32 */
16601660
#endif
16611661
};
1662-
int j;
1662+
size_t j;
16631663

16641664
needs_extension:
16651665
for (j = 0; j < sizeof(extension) / sizeof(extension[0]); j++) {

dln.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030

3131
DEPRECATED(char *dln_find_exe(const char*,const char*));
3232
DEPRECATED(char *dln_find_file(const char*,const char*));
33-
char *dln_find_exe_r(const char*,const char*,char*,int);
34-
char *dln_find_file_r(const char*,const char*,char*,int);
33+
char *dln_find_exe_r(const char*,const char*,char*,size_t);
34+
char *dln_find_file_r(const char*,const char*,char*,size_t);
3535

3636
#ifdef USE_DLN_A_OUT
3737
extern char *dln_argv0;

file.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ static VALUE
654654
rb_stat_inspect(VALUE self)
655655
{
656656
VALUE str;
657-
int i;
657+
size_t i;
658658
static const struct {
659659
const char *name;
660660
VALUE (*func)(VALUE);
@@ -2664,7 +2664,7 @@ file_expand_path(VALUE fname, VALUE dname, int abs_mode, VALUE result)
26642664
{
26652665
const char *s, *b;
26662666
char *buf, *p, *pend, *root;
2667-
long buflen, dirlen;
2667+
size_t buflen, dirlen;
26682668
int tainted;
26692669
rb_encoding *extenc = 0;
26702670

util.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -437,11 +437,11 @@ typedef struct { char *LL, *RR; } stack_node; /* Stack structure for L,l,R,r */
437437
((*cmp)(b,c,d)>0 ? b : ((*cmp)(a,c,d)<0 ? a : c)))
438438

439439
void
440-
ruby_qsort(void* base, const int nel, const int size,
440+
ruby_qsort(void* base, const size_t nel, const size_t size,
441441
int (*cmp)(const void*, const void*, void*), void *d)
442442
{
443443
register char *l, *r, *m; /* l,r:left,right group m:median point */
444-
register int t, eq_l, eq_r; /* eq_l: all items in left group are equal to S */
444+
register size_t t, eq_l, eq_r; /* eq_l: all items in left group are equal to S */
445445
char *L = base; /* left end of curren region */
446446
char *R = (char*)base + size*(nel-1); /* right end of current region */
447447
int chklim = 63; /* threshold of ordering element check */

0 commit comments

Comments
 (0)