summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--dln.c14
-rw-r--r--dln.h4
-rw-r--r--file.c4
-rw-r--r--util.c4
5 files changed, 22 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 0750de3874..2a02685771 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/dln.c b/dln.c
index 023df69016..ae22c69a54 100644
--- a/dln.c
+++ b/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++) {
diff --git a/dln.h b/dln.h
index f70b0d4455..47ff3eaf59 100644
--- a/dln.h
+++ b/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;
diff --git a/file.c b/file.c
index d30a2c6692..5ad7665bbf 100644
--- a/file.c
+++ b/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;
diff --git a/util.c b/util.c
index 1417cb6fbd..4a6902eaa7 100644
--- a/util.c
+++ b/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 */