* dln.c: avoid warning of const to non-const convertion.

[ruby-dev:27041]

* eval.c, io.c, ruby.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ocean 2005-09-12 11:03:24 +00:00
Родитель 7ecb12dc27
Коммит 4409f88ad8
5 изменённых файлов: 30 добавлений и 21 удалений

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

@ -1,3 +1,10 @@
Mon Sep 12 19:58:53 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
* dln.c: avoid warning of const to non-const convertion.
[ruby-dev:27041]
* eval.c, io.c, ruby.c: ditto.
Mon Sep 12 19:26:29 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
* array.c: moved to ANSI function style from K&R function style.

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

@ -1603,7 +1603,7 @@ dln_load(const char *file)
return 0; /* dummy return */
}
static char *dln_find_1(char *fname, char *path, int exe_flag);
static char *dln_find_1(const char *fname, const char *path, int exe_flag);
char *
dln_find_exe(const char *fname, const char *path)
@ -1665,31 +1665,33 @@ conv_to_posix_path(win32, posix, len)
static char fbuf[MAXPATHLEN];
static char *
dln_find_1(char *fname, char *path, int exe_flag /* non 0 if looking for executable. */)
dln_find_1(const char *fname, const char *path, int exe_flag /* non 0 if looking for executable. */)
{
register char *dp;
register char *ep;
register const char *dp;
register const char *ep;
register char *bp;
struct stat st;
#ifdef __MACOS__
const char* mac_fullpath;
#endif
if (!fname) return fname;
if (fname[0] == '/') return fname;
if (strncmp("./", fname, 2) == 0 || strncmp("../", fname, 3) == 0)
return fname;
if (exe_flag && strchr(fname, '/')) return fname;
#define RETURN_IF(expr) if (expr) return (char *)fname;
RETURN_IF(!fname);
RETURN_IF(fname[0] == '/');
RETURN_IF(strncmp("./", fname, 2) == 0 || strncmp("../", fname, 3) == 0);
RETURN_IF(exe_flag && strchr(fname, '/'));
#ifdef DOSISH
if (fname[0] == '\\') return fname;
RETURN_IF(fname[0] == '\\');
# ifdef DOSISH_DRIVE_LETTER
if (strlen(fname) > 2 && fname[1] == ':') return fname;
RETURN_IF(strlen(fname) > 2 && fname[1] == ':');
# endif
if (strncmp(".\\", fname, 2) == 0 || strncmp("..\\", fname, 3) == 0)
return fname;
if (exe_flag && strchr(fname, '\\')) return fname;
RETURN_IF(strncmp(".\\", fname, 2) == 0 || strncmp("..\\", fname, 3) == 0);
RETURN_IF(exe_flag && strchr(fname, '\\'));
#endif
#undef RETURN_IF
for (dp = path;; dp = ++ep) {
register int l;
int i;

10
eval.c
Просмотреть файл

@ -1045,7 +1045,7 @@ static VALUE module_setup _((VALUE,NODE*));
static VALUE massign _((VALUE,NODE*,VALUE,int));
static void assign _((VALUE,NODE*,VALUE,int));
static int formal_assign _((VALUE, NODE*, int, VALUE*, VALUE*));
static int formal_assign _((VALUE, NODE*, int, const VALUE*, VALUE*));
typedef struct event_hook {
rb_event_hook_func_t func;
@ -5337,7 +5337,7 @@ static int last_call_status;
*/
static VALUE
rb_method_missing(int argc, VALUE *argv, VALUE obj)
rb_method_missing(int argc, const VALUE *argv, VALUE obj)
{
ID id;
VALUE exc = rb_eNoMethodError;
@ -5412,7 +5412,7 @@ method_missing(VALUE obj, ID id, int argc, const VALUE *argv, int call_status)
}
static inline VALUE
call_cfunc(VALUE (*func) (/* ??? */), VALUE recv, int len, int argc, VALUE *argv)
call_cfunc(VALUE (*func) (/* ??? */), VALUE recv, int len, int argc, const VALUE *argv)
{
if (len >= 0 && argc != len) {
rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)",
@ -5496,7 +5496,7 @@ call_cfunc(VALUE (*func) (/* ??? */), VALUE recv, int len, int argc, VALUE *argv
}
static int
formal_assign(VALUE recv, NODE *node, int argc, VALUE *argv, VALUE *local_vars)
formal_assign(VALUE recv, NODE *node, int argc, const VALUE *argv, VALUE *local_vars)
{
int i;
int nopt = 0;
@ -5569,7 +5569,7 @@ formal_assign(VALUE recv, NODE *node, int argc, VALUE *argv, VALUE *local_vars)
static VALUE
rb_call0(VALUE klass, VALUE recv, ID id, ID oid,
int argc /* OK */, VALUE *argv /* OK */, NODE *volatile body, int flags)
int argc /* OK */, const VALUE *argv /* OK */, NODE *volatile body, int flags)
{
NODE *b2; /* OK */
volatile VALUE result = Qnil;

2
io.c
Просмотреть файл

@ -2632,7 +2632,7 @@ rb_file_open(const char *fname, const char *mode)
}
static VALUE
rb_file_sysopen_internal(VALUE io, char *fname, int flags, int mode)
rb_file_sysopen_internal(VALUE io, const char *fname, int flags, int mode)
{
OpenFile *fptr;

2
ruby.c
Просмотреть файл

@ -118,7 +118,7 @@ extern VALUE rb_load_path;
#if defined _WIN32 || defined __CYGWIN__ || defined __DJGPP__
static char *
rubylib_mangle(char *s, unsigned int l)
rubylib_mangle(const char *s, unsigned int l)
{
static char *newp, *oldp;
static int newl, oldl, notfound;