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

* 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
parent 7ecb12dc27
commit 4409f88ad8
5 changed files with 30 additions and 21 deletions

View file

@ -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> 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. * array.c: moved to ANSI function style from K&R function style.

30
dln.c
View file

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

10
eval.c
View file

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

2
io.c
View file

@ -2632,7 +2632,7 @@ rb_file_open(const char *fname, const char *mode)
} }
static VALUE 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; OpenFile *fptr;

2
ruby.c
View file

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