mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* suppress warnings with -Wwrite-string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f3c0922a5a
commit
1378795e08
23 changed files with 111 additions and 104 deletions
|
@ -1,3 +1,7 @@
|
|||
Sat May 31 18:28:17 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* suppress warnings with -Wwrite-string.
|
||||
|
||||
Sat May 31 15:58:08 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* Makefile.in, configure.in (warnflags): defaulted to -Wall
|
||||
|
|
2
dir.c
2
dir.c
|
@ -475,7 +475,7 @@ dir_inspect(dir)
|
|||
|
||||
Data_Get_Struct(dir, struct dir_data, dirp);
|
||||
if (dirp->path) {
|
||||
char *c = rb_obj_classname(dir);
|
||||
const char *c = rb_obj_classname(dir);
|
||||
int len = strlen(c) + strlen(dirp->path) + 4;
|
||||
VALUE s = rb_str_new(0, len);
|
||||
snprintf(RSTRING_PTR(s), len+1, "#<%s:%s>", c, dirp->path);
|
||||
|
|
8
error.c
8
error.c
|
@ -259,7 +259,7 @@ rb_check_type(x, t)
|
|||
if (TYPE(x) != t) {
|
||||
while (type->type >= 0) {
|
||||
if (type->type == t) {
|
||||
char *etype;
|
||||
const char *etype;
|
||||
|
||||
if (NIL_P(x)) {
|
||||
etype = "nil";
|
||||
|
@ -500,7 +500,7 @@ rb_check_backtrace(bt)
|
|||
VALUE bt;
|
||||
{
|
||||
long i;
|
||||
static char *err = "backtrace must be Array of String";
|
||||
static const char err[] = "backtrace must be Array of String";
|
||||
|
||||
if (!NIL_P(bt)) {
|
||||
int t = TYPE(bt);
|
||||
|
@ -729,7 +729,7 @@ name_err_mesg_to_str(obj)
|
|||
mesg = ptr[0];
|
||||
if (NIL_P(mesg)) return Qnil;
|
||||
else {
|
||||
char *desc = 0;
|
||||
const char *desc = 0;
|
||||
VALUE d = 0, args[3];
|
||||
|
||||
obj = ptr[1];
|
||||
|
@ -883,7 +883,7 @@ syserr_initialize(argc, argv, self)
|
|||
#if !defined(_WIN32) && !defined(__VMS)
|
||||
char *strerror();
|
||||
#endif
|
||||
char *err;
|
||||
const char *err;
|
||||
VALUE mesg, error;
|
||||
VALUE klass = rb_obj_class(self);
|
||||
|
||||
|
|
58
eval.c
58
eval.c
|
@ -1103,8 +1103,8 @@ static void scope_dup _((struct SCOPE *));
|
|||
} while (0)
|
||||
|
||||
static VALUE rb_eval _((VALUE,NODE*));
|
||||
static VALUE eval _((VALUE,VALUE,VALUE,char*,int));
|
||||
static NODE *compile _((VALUE, char*, int));
|
||||
static VALUE eval _((VALUE,VALUE,VALUE,const char*,int));
|
||||
static NODE *compile _((VALUE, const char*, int));
|
||||
|
||||
static VALUE rb_yield_0 _((VALUE, VALUE, VALUE, int, int));
|
||||
|
||||
|
@ -1227,7 +1227,7 @@ error_print()
|
|||
{
|
||||
VALUE errat = Qnil; /* OK */
|
||||
volatile VALUE eclass, e;
|
||||
char *einfo;
|
||||
const char *einfo;
|
||||
long elen;
|
||||
|
||||
if (NIL_P(ruby_errinfo)) return;
|
||||
|
@ -2032,7 +2032,7 @@ void
|
|||
rb_frozen_class_p(klass)
|
||||
VALUE klass;
|
||||
{
|
||||
char *desc = "something(?!)";
|
||||
const char *desc = "something(?!)";
|
||||
|
||||
if (OBJ_FROZEN(klass)) {
|
||||
if (FL_TEST(klass, FL_SINGLETON))
|
||||
|
@ -2070,7 +2070,7 @@ rb_undef(klass, id)
|
|||
}
|
||||
body = search_method(klass, id, &origin);
|
||||
if (!body || !body->nd_body) {
|
||||
char *s0 = " class";
|
||||
const char *s0 = " class";
|
||||
VALUE c = klass;
|
||||
|
||||
if (FL_TEST(c, FL_SINGLETON)) {
|
||||
|
@ -2322,9 +2322,9 @@ rb_copy_node_scope(node, rval)
|
|||
|
||||
#define MATCH_DATA *rb_svar(node->nd_cnt)
|
||||
|
||||
static char* is_defined _((VALUE, NODE*, char*));
|
||||
static const char* is_defined _((VALUE, NODE*, char*));
|
||||
|
||||
static char*
|
||||
static const char*
|
||||
arg_defined(self, node, buf, type)
|
||||
VALUE self;
|
||||
NODE *node;
|
||||
|
@ -2351,7 +2351,7 @@ arg_defined(self, node, buf, type)
|
|||
return type;
|
||||
}
|
||||
|
||||
static char*
|
||||
static const char*
|
||||
is_defined(self, node, buf)
|
||||
VALUE self;
|
||||
NODE *node; /* OK */
|
||||
|
@ -2671,27 +2671,27 @@ set_trace_func(obj, trace)
|
|||
return trace;
|
||||
}
|
||||
|
||||
static char *
|
||||
static const char *
|
||||
get_event_name(rb_event_t event)
|
||||
{
|
||||
switch (event) {
|
||||
case RUBY_EVENT_LINE:
|
||||
case RUBY_EVENT_LINE:
|
||||
return "line";
|
||||
case RUBY_EVENT_CLASS:
|
||||
case RUBY_EVENT_CLASS:
|
||||
return "class";
|
||||
case RUBY_EVENT_END:
|
||||
case RUBY_EVENT_END:
|
||||
return "end";
|
||||
case RUBY_EVENT_CALL:
|
||||
case RUBY_EVENT_CALL:
|
||||
return "call";
|
||||
case RUBY_EVENT_RETURN:
|
||||
case RUBY_EVENT_RETURN:
|
||||
return "return";
|
||||
case RUBY_EVENT_C_CALL:
|
||||
case RUBY_EVENT_C_CALL:
|
||||
return "c-call";
|
||||
case RUBY_EVENT_C_RETURN:
|
||||
case RUBY_EVENT_C_RETURN:
|
||||
return "c-return";
|
||||
case RUBY_EVENT_RAISE:
|
||||
case RUBY_EVENT_RAISE:
|
||||
return "raise";
|
||||
default:
|
||||
default:
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
|
@ -2708,7 +2708,7 @@ call_trace_func(event, node, self, id, klass)
|
|||
struct FRAME *prev;
|
||||
NODE *node_save;
|
||||
VALUE srcfile;
|
||||
char *event_name;
|
||||
const char *event_name;
|
||||
|
||||
if (!trace_func) return;
|
||||
if (tracing) return;
|
||||
|
@ -4136,7 +4136,7 @@ rb_eval(self, n)
|
|||
case NODE_DEFINED:
|
||||
{
|
||||
char buf[20];
|
||||
char *desc = is_defined(self, node->nd_head, buf);
|
||||
const char *desc = is_defined(self, node->nd_head, buf);
|
||||
|
||||
if (desc) result = rb_str_new2(desc);
|
||||
else result = Qnil;
|
||||
|
@ -4804,7 +4804,7 @@ proc_jump_error(state, result)
|
|||
VALUE result;
|
||||
{
|
||||
char mesg[32];
|
||||
char *statement;
|
||||
const char *statement;
|
||||
|
||||
switch (state) {
|
||||
case TAG_BREAK:
|
||||
|
@ -5638,7 +5638,7 @@ rb_method_missing(argc, argv, obj)
|
|||
{
|
||||
ID id;
|
||||
VALUE exc = rb_eNoMethodError;
|
||||
char *format = 0;
|
||||
const char *format = 0;
|
||||
NODE *cnode = ruby_current_node;
|
||||
|
||||
if (argc == 0 || !SYMBOL_P(argv[0])) {
|
||||
|
@ -6448,7 +6448,7 @@ rb_frame_this_func()
|
|||
static NODE*
|
||||
compile(src, file, line)
|
||||
VALUE src;
|
||||
char *file;
|
||||
const char *file;
|
||||
int line;
|
||||
{
|
||||
NODE *node;
|
||||
|
@ -6468,7 +6468,7 @@ compile(src, file, line)
|
|||
static VALUE
|
||||
eval(self, src, scope, file, line)
|
||||
VALUE self, src, scope;
|
||||
char *file;
|
||||
const char *file;
|
||||
int line;
|
||||
{
|
||||
struct BLOCK *data = NULL;
|
||||
|
@ -6629,7 +6629,7 @@ rb_f_eval(argc, argv, self)
|
|||
VALUE self;
|
||||
{
|
||||
VALUE src, scope, vfile, vline;
|
||||
char *file = "(eval)";
|
||||
const char *file = "(eval)";
|
||||
int line = 1;
|
||||
|
||||
rb_scan_args(argc, argv, "13", &src, &scope, &vfile, &vline);
|
||||
|
@ -6783,7 +6783,7 @@ specific_eval(argc, argv, klass, self)
|
|||
return yield_under(klass, self, Qundef);
|
||||
}
|
||||
else {
|
||||
char *file = "(eval)";
|
||||
const char *file = "(eval)";
|
||||
int line = 1;
|
||||
|
||||
if (argc == 0) {
|
||||
|
@ -9014,7 +9014,7 @@ proc_to_s(self)
|
|||
{
|
||||
struct BLOCK *data;
|
||||
NODE *node;
|
||||
char *cname = rb_obj_classname(self);
|
||||
const char *cname = rb_obj_classname(self);
|
||||
const int w = (sizeof(VALUE) * CHAR_BIT) / 4;
|
||||
long len = strlen(cname)+6+w; /* 6:tags 16:addr */
|
||||
VALUE str;
|
||||
|
@ -9748,7 +9748,7 @@ method_inspect(method)
|
|||
struct METHOD *data;
|
||||
VALUE str;
|
||||
const char *s;
|
||||
char *sharp = "#";
|
||||
const char *sharp = "#";
|
||||
|
||||
Data_Get_Struct(method, struct METHOD, data);
|
||||
str = rb_str_buf_new2("#<");
|
||||
|
@ -12923,7 +12923,7 @@ static VALUE
|
|||
rb_thread_inspect(thread)
|
||||
VALUE thread;
|
||||
{
|
||||
char *cname = rb_obj_classname(thread);
|
||||
const char *cname = rb_obj_classname(thread);
|
||||
rb_thread_t th = rb_thread_check(thread);
|
||||
const char *status = thread_status_name(th->status);
|
||||
VALUE str;
|
||||
|
|
2
file.c
2
file.c
|
@ -1495,7 +1495,7 @@ static VALUE
|
|||
rb_file_ftype(st)
|
||||
struct stat *st;
|
||||
{
|
||||
char *t;
|
||||
const char *t;
|
||||
|
||||
if (S_ISREG(st->st_mode)) {
|
||||
t = "file";
|
||||
|
|
2
intern.h
2
intern.h
|
@ -467,7 +467,7 @@ VALUE rb_struct_alloc _((VALUE, VALUE));
|
|||
VALUE rb_struct_aref _((VALUE, VALUE));
|
||||
VALUE rb_struct_aset _((VALUE, VALUE, VALUE));
|
||||
VALUE rb_struct_getmember _((VALUE, ID));
|
||||
VALUE rb_struct_iv_get _((VALUE, char*));
|
||||
VALUE rb_struct_iv_get _((VALUE, const char*));
|
||||
VALUE rb_struct_s_members _((VALUE));
|
||||
VALUE rb_struct_members _((VALUE));
|
||||
/* time.c */
|
||||
|
|
29
io.c
29
io.c
|
@ -1000,7 +1000,8 @@ rb_io_inspect(obj)
|
|||
VALUE obj;
|
||||
{
|
||||
rb_io_t *fptr;
|
||||
char *buf, *cname, *st = "";
|
||||
char *buf;
|
||||
const char *cname, *st = "";
|
||||
long len;
|
||||
|
||||
fptr = RFILE(rb_io_taint_check(obj))->fptr;
|
||||
|
@ -1703,7 +1704,7 @@ rb_io_getline(rs, io)
|
|||
}
|
||||
else {
|
||||
int c, newline;
|
||||
char *rsptr;
|
||||
const char *rsptr;
|
||||
long rslen;
|
||||
int rspara = 0;
|
||||
|
||||
|
@ -2705,7 +2706,7 @@ rb_io_binmode(io)
|
|||
return io;
|
||||
}
|
||||
|
||||
char*
|
||||
const char*
|
||||
rb_io_flags_mode(flags)
|
||||
int flags;
|
||||
{
|
||||
|
@ -2858,7 +2859,7 @@ rb_io_mode_modenum(mode)
|
|||
|
||||
#define MODENUM_MAX 4
|
||||
|
||||
static char*
|
||||
static const char*
|
||||
rb_io_modenum_mode(flags)
|
||||
int flags;
|
||||
{
|
||||
|
@ -3005,7 +3006,7 @@ rb_file_sysopen_internal(io, fname, flags, mode)
|
|||
{
|
||||
rb_io_t *fptr;
|
||||
int fd;
|
||||
char *m;
|
||||
const char *m;
|
||||
|
||||
MakeOpenFile(io, fptr);
|
||||
|
||||
|
@ -3123,12 +3124,12 @@ rb_io_unbuffered(fptr)
|
|||
rb_io_synchronized(fptr);
|
||||
}
|
||||
|
||||
static VALUE pipe_open(VALUE pstr, char *pname, char *mode);
|
||||
static VALUE pipe_open(VALUE pstr, const char *pname, const char *mode);
|
||||
|
||||
static VALUE
|
||||
pipe_open(pstr, pname, mode)
|
||||
VALUE pstr;
|
||||
char *pname, *mode;
|
||||
const char *pname, *mode;
|
||||
{
|
||||
int modef = rb_io_mode_flags(mode);
|
||||
rb_io_t *fptr;
|
||||
|
@ -3350,7 +3351,7 @@ rb_io_s_popen(argc, argv, klass)
|
|||
VALUE *argv;
|
||||
VALUE klass;
|
||||
{
|
||||
char *mode;
|
||||
const char *mode;
|
||||
VALUE pname, pmode, port;
|
||||
|
||||
if (rb_scan_args(argc, argv, "11", &pname, &pmode) == 1) {
|
||||
|
@ -3388,7 +3389,7 @@ rb_open_file(argc, argv, io)
|
|||
VALUE io;
|
||||
{
|
||||
VALUE fname, vmode, perm;
|
||||
char *path, *mode;
|
||||
const char *path, *mode;
|
||||
int flags, fmode;
|
||||
|
||||
rb_scan_args(argc, argv, "12", &fname, &vmode, &perm);
|
||||
|
@ -3606,7 +3607,7 @@ rb_io_check_io(io)
|
|||
return rb_check_convert_type(io, T_FILE, "IO", "to_io");
|
||||
}
|
||||
|
||||
static char*
|
||||
static const char*
|
||||
rb_io_mode_string(fptr)
|
||||
rb_io_t *fptr;
|
||||
{
|
||||
|
@ -3626,7 +3627,7 @@ io_reopen(io, nfile)
|
|||
VALUE io, nfile;
|
||||
{
|
||||
rb_io_t *fptr, *orig;
|
||||
char *mode;
|
||||
const char *mode;
|
||||
int fd, fd2;
|
||||
off_t pos = 0;
|
||||
|
||||
|
@ -3742,7 +3743,7 @@ rb_io_reopen(argc, argv, file)
|
|||
VALUE file;
|
||||
{
|
||||
VALUE fname, nmode;
|
||||
char *mode;
|
||||
const char *mode;
|
||||
rb_io_t *fptr;
|
||||
|
||||
rb_secure(4);
|
||||
|
@ -3805,7 +3806,7 @@ rb_io_init_copy(dest, io)
|
|||
{
|
||||
rb_io_t *fptr, *orig;
|
||||
int fd;
|
||||
char *mode;
|
||||
const char *mode;
|
||||
|
||||
io = rb_io_get_io(io);
|
||||
if (dest == io) return dest;
|
||||
|
@ -4425,7 +4426,7 @@ rb_io_s_new(argc, argv, klass)
|
|||
VALUE klass;
|
||||
{
|
||||
if (rb_block_given_p()) {
|
||||
char *cname = rb_class2name(klass);
|
||||
const char *cname = rb_class2name(klass);
|
||||
|
||||
rb_warn("%s::new() does not take block; use %s::open() instead",
|
||||
cname, cname);
|
||||
|
|
2
keywords
2
keywords
|
@ -1,4 +1,4 @@
|
|||
struct kwtable {char *name; int id[2]; enum lex_state state;};
|
||||
struct kwtable {const char *name; int id[2]; enum lex_state state;};
|
||||
%%
|
||||
__LINE__, {k__LINE__, k__LINE__}, EXPR_END
|
||||
__FILE__, {k__FILE__, k__FILE__}, EXPR_END
|
||||
|
|
2
lex.c
2
lex.c
|
@ -1,6 +1,6 @@
|
|||
/* C code produced by gperf version 2.7.2 */
|
||||
/* Command-line: gperf -p -j1 -i 1 -g -o -t -N rb_reserved_word -k'1,3,$' ./keywords */
|
||||
struct kwtable {char *name; int id[2]; enum lex_state state;};
|
||||
struct kwtable {const char *name; int id[2]; enum lex_state state;};
|
||||
|
||||
#define TOTAL_KEYWORDS 40
|
||||
#define MIN_WORD_LENGTH 2
|
||||
|
|
|
@ -338,7 +338,7 @@ w_symbol(id, arg)
|
|||
ID id;
|
||||
struct dump_arg *arg;
|
||||
{
|
||||
char *sym = rb_id2name(id);
|
||||
const char *sym = rb_id2name(id);
|
||||
st_data_t num;
|
||||
|
||||
if (st_lookup(arg->symbols, id, &num)) {
|
||||
|
@ -381,7 +381,7 @@ w_extended(klass, arg, check)
|
|||
struct dump_arg *arg;
|
||||
int check;
|
||||
{
|
||||
char *path;
|
||||
const char *path;
|
||||
|
||||
if (check && FL_TEST(klass, FL_SINGLETON)) {
|
||||
if (RCLASS(klass)->m_tbl->num_entries ||
|
||||
|
@ -948,7 +948,7 @@ r_symbol(arg)
|
|||
return r_symreal(arg);
|
||||
}
|
||||
|
||||
static char*
|
||||
static const char*
|
||||
r_unique(arg)
|
||||
struct load_arg *arg;
|
||||
{
|
||||
|
|
|
@ -2776,7 +2776,7 @@ static VALUE
|
|||
fix_id2name(fix)
|
||||
VALUE fix;
|
||||
{
|
||||
char *name = rb_id2name(FIX2UINT(fix));
|
||||
const char *name = rb_id2name(FIX2UINT(fix));
|
||||
if (name) return rb_str_new2(name);
|
||||
return Qnil;
|
||||
}
|
||||
|
|
9
object.c
9
object.c
|
@ -314,7 +314,7 @@ VALUE
|
|||
rb_any_to_s(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
char *cname = rb_obj_classname(obj);
|
||||
const char *cname = rb_obj_classname(obj);
|
||||
size_t len;
|
||||
VALUE str;
|
||||
|
||||
|
@ -341,7 +341,7 @@ inspect_i(id, value, str)
|
|||
VALUE str;
|
||||
{
|
||||
VALUE str2;
|
||||
char *ivname;
|
||||
const char *ivname;
|
||||
|
||||
/* need not to show internal data */
|
||||
if (CLASS_OF(value) == 0) return ST_CONTINUE;
|
||||
|
@ -397,9 +397,8 @@ rb_obj_inspect(obj)
|
|||
&& ROBJECT(obj)->iv_tbl->num_entries > 0) {
|
||||
VALUE str;
|
||||
size_t len;
|
||||
char *c;
|
||||
const char *c = rb_obj_classname(obj);
|
||||
|
||||
c = rb_obj_classname(obj);
|
||||
if (rb_inspecting_p(obj)) {
|
||||
len = strlen(c)+10+16+1;
|
||||
str = rb_str_new(0, len); /* 10:tags 16:addr 1:nul */
|
||||
|
@ -1161,7 +1160,7 @@ sym_inspect(sym)
|
|||
VALUE sym;
|
||||
{
|
||||
VALUE str;
|
||||
char *name;
|
||||
const char *name;
|
||||
ID id = SYM2ID(sym);
|
||||
|
||||
name = rb_id2name(id);
|
||||
|
|
20
pack.c
20
pack.c
|
@ -366,7 +366,7 @@ num2i32(x)
|
|||
#endif
|
||||
static const char toofew[] = "too few arguments";
|
||||
|
||||
static void encodes _((VALUE,char*,long,int));
|
||||
static void encodes _((VALUE,const char*,long,int));
|
||||
static void qpencode _((VALUE,VALUE,long));
|
||||
|
||||
static int uv_to_utf8 _((char*,unsigned long));
|
||||
|
@ -441,13 +441,13 @@ static VALUE
|
|||
pack_pack(ary, fmt)
|
||||
VALUE ary, fmt;
|
||||
{
|
||||
static char *nul10 = "\0\0\0\0\0\0\0\0\0\0";
|
||||
static char *spc10 = " ";
|
||||
static const char nul10[] = "\0\0\0\0\0\0\0\0\0\0";
|
||||
static const char spc10[] = " ";
|
||||
char *p, *pend;
|
||||
VALUE res, from, associates = 0;
|
||||
char type;
|
||||
long items, len, idx, plen;
|
||||
char *ptr;
|
||||
const char *ptr;
|
||||
#ifdef NATINT_PACK
|
||||
int natint; /* native integer */
|
||||
#endif
|
||||
|
@ -1004,21 +1004,21 @@ pack_pack(ary, fmt)
|
|||
return res;
|
||||
}
|
||||
|
||||
static char uu_table[] =
|
||||
static const char uu_table[] =
|
||||
"`!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_";
|
||||
static char b64_table[] =
|
||||
static const char b64_table[] =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
||||
static void
|
||||
encodes(str, s, len, type)
|
||||
VALUE str;
|
||||
char *s;
|
||||
const char *s;
|
||||
long len;
|
||||
int type;
|
||||
{
|
||||
char *buff = ALLOCA_N(char, len * 4 / 3 + 6);
|
||||
long i = 0;
|
||||
char *trans = type == 'u' ? uu_table : b64_table;
|
||||
const char *trans = type == 'u' ? uu_table : b64_table;
|
||||
int padding;
|
||||
|
||||
if (type == 'u') {
|
||||
|
@ -1304,7 +1304,7 @@ static VALUE
|
|||
pack_unpack(str, fmt)
|
||||
VALUE str, fmt;
|
||||
{
|
||||
static char *hexdigits = "0123456789abcdef0123456789ABCDEFx";
|
||||
static const char hexdigits[] = "0123456789abcdef0123456789ABCDEFx";
|
||||
char *s, *send;
|
||||
char *p, *pend;
|
||||
VALUE ary;
|
||||
|
@ -1338,7 +1338,7 @@ pack_unpack(str, fmt)
|
|||
}
|
||||
star = 0;
|
||||
if (*p == '_' || *p == '!') {
|
||||
char *natstr = "sSiIlL";
|
||||
static const char natstr[] = "sSiIlL";
|
||||
|
||||
if (strchr(natstr, type)) {
|
||||
#ifdef NATINT_PACK
|
||||
|
|
10
parse.y
10
parse.y
|
@ -4524,7 +4524,7 @@ yylex()
|
|||
}
|
||||
|
||||
if (lex_state != EXPR_DOT) {
|
||||
struct kwtable *kw;
|
||||
const struct kwtable *kw;
|
||||
|
||||
/* See if it is a reserved word. */
|
||||
kw = rb_reserved_word(tok(), toklen());
|
||||
|
@ -5178,7 +5178,7 @@ static void
|
|||
void_expr0(node)
|
||||
NODE *node;
|
||||
{
|
||||
char *useless = 0;
|
||||
const char *useless = 0;
|
||||
|
||||
if (!RTEST(ruby_verbose)) return;
|
||||
|
||||
|
@ -5945,7 +5945,7 @@ rb_parser_while_loop(chop, split)
|
|||
|
||||
static struct {
|
||||
ID token;
|
||||
char *name;
|
||||
const char *name;
|
||||
} op_tbl[] = {
|
||||
{tDOT2, ".."},
|
||||
{tDOT3, "..."},
|
||||
|
@ -6193,11 +6193,11 @@ rb_intern(name)
|
|||
return id;
|
||||
}
|
||||
|
||||
char *
|
||||
const char *
|
||||
rb_id2name(id)
|
||||
ID id;
|
||||
{
|
||||
char *name;
|
||||
const char *name;
|
||||
st_data_t data;
|
||||
|
||||
if (id < tLAST_TOKEN) {
|
||||
|
|
9
re.c
9
re.c
|
@ -595,7 +595,7 @@ static VALUE
|
|||
rb_reg_kcode_m(re)
|
||||
VALUE re;
|
||||
{
|
||||
char *kcode;
|
||||
const char *kcode;
|
||||
|
||||
if (FL_TEST(re, KCODE_FIXED)) {
|
||||
switch (RBASIC(re)->flags & KCODE_MASK) {
|
||||
|
@ -1340,7 +1340,7 @@ match_string(match)
|
|||
static VALUE
|
||||
match_inspect(VALUE match)
|
||||
{
|
||||
char *cname = rb_obj_classname(match);
|
||||
const char *cname = rb_obj_classname(match);
|
||||
VALUE str;
|
||||
int i;
|
||||
struct re_registers *regs = RMATCH(match)->regs;
|
||||
|
@ -1477,8 +1477,9 @@ rb_reg_regcomp(str)
|
|||
|
||||
case_cache = ruby_ignorecase;
|
||||
kcode_cache = reg_kcode;
|
||||
return reg_cache = rb_reg_new(RSTRING(str)->ptr, RSTRING(str)->len,
|
||||
ruby_ignorecase);
|
||||
reg_cache = rb_reg_new(RSTRING(str)->ptr, RSTRING(str)->len, ruby_ignorecase);
|
||||
RB_GC_GUARD(save_str);
|
||||
return reg_cache;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
2
ruby.c
2
ruby.c
|
@ -65,7 +65,7 @@ static VALUE do_loop = Qfalse, do_print = Qfalse;
|
|||
static VALUE do_check = Qfalse, do_line = Qfalse;
|
||||
static VALUE do_split = Qfalse;
|
||||
|
||||
static char *script;
|
||||
static const char *script;
|
||||
|
||||
static int origargc;
|
||||
static char **origargv;
|
||||
|
|
6
ruby.h
6
ruby.h
|
@ -538,11 +538,11 @@ void rb_gc_register_address _((VALUE*));
|
|||
void rb_gc_unregister_address _((VALUE*));
|
||||
|
||||
ID rb_intern _((const char*));
|
||||
char *rb_id2name _((ID));
|
||||
const char *rb_id2name _((ID));
|
||||
ID rb_to_id _((VALUE));
|
||||
|
||||
char *rb_class2name _((VALUE));
|
||||
char *rb_obj_classname _((VALUE));
|
||||
const char *rb_class2name _((VALUE));
|
||||
const char *rb_obj_classname _((VALUE));
|
||||
|
||||
void rb_p _((VALUE));
|
||||
|
||||
|
|
8
signal.c
8
signal.c
|
@ -36,7 +36,7 @@
|
|||
#endif
|
||||
|
||||
static struct signals {
|
||||
char *signm;
|
||||
const char *signm;
|
||||
int signo;
|
||||
} siglist [] = {
|
||||
{"EXIT", 0},
|
||||
|
@ -186,7 +186,7 @@ signm2signo(nm)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static char*
|
||||
static const char*
|
||||
signo2signm(no)
|
||||
int no;
|
||||
{
|
||||
|
@ -327,7 +327,7 @@ rb_f_kill(argc, argv)
|
|||
int negative = 0;
|
||||
int sig;
|
||||
int i;
|
||||
char *s;
|
||||
const char *s;
|
||||
|
||||
rb_secure(2);
|
||||
if (argc < 2)
|
||||
|
@ -706,7 +706,7 @@ trap(arg)
|
|||
sighandler_t func, oldfunc;
|
||||
VALUE command, oldcmd;
|
||||
int sig = -1;
|
||||
char *s;
|
||||
const char *s;
|
||||
|
||||
func = sighandler;
|
||||
command = arg->cmd;
|
||||
|
|
10
string.c
10
string.c
|
@ -545,7 +545,8 @@ rb_str_associated(str)
|
|||
return Qfalse;
|
||||
}
|
||||
|
||||
static char *null_str = "";
|
||||
static const char null_str[] = "";
|
||||
#define null_str ((char *)null_str)
|
||||
|
||||
VALUE
|
||||
rb_string_value(ptr)
|
||||
|
@ -4480,7 +4481,7 @@ rb_str_crypt(str, salt)
|
|||
{
|
||||
extern char *crypt();
|
||||
VALUE result;
|
||||
char *s;
|
||||
const char *s;
|
||||
|
||||
StringValue(salt);
|
||||
if (RSTRING(salt)->len < 2)
|
||||
|
@ -4607,7 +4608,8 @@ rb_str_justify(argc, argv, str, jflag)
|
|||
VALUE w;
|
||||
long width, flen = 0;
|
||||
VALUE res;
|
||||
char *p, *pend, *f = " ";
|
||||
char *p, *pend;
|
||||
const char *f = " ";
|
||||
long n;
|
||||
VALUE pad;
|
||||
|
||||
|
@ -4633,7 +4635,7 @@ rb_str_justify(argc, argv, str, jflag)
|
|||
}
|
||||
}
|
||||
else {
|
||||
char *q = f;
|
||||
const char *q = f;
|
||||
while (p + flen <= pend) {
|
||||
memcpy(p,f,flen);
|
||||
p += flen;
|
||||
|
|
8
struct.c
8
struct.c
|
@ -20,7 +20,7 @@ static VALUE struct_alloc _((VALUE));
|
|||
VALUE
|
||||
rb_struct_iv_get(c, name)
|
||||
VALUE c;
|
||||
char *name;
|
||||
const char *name;
|
||||
{
|
||||
ID id;
|
||||
|
||||
|
@ -470,7 +470,7 @@ static VALUE
|
|||
inspect_struct(s)
|
||||
VALUE s;
|
||||
{
|
||||
char *cname = rb_class2name(rb_obj_class(s));
|
||||
const char *cname = rb_class2name(rb_obj_class(s));
|
||||
VALUE str, members;
|
||||
long i;
|
||||
|
||||
|
@ -481,7 +481,7 @@ inspect_struct(s)
|
|||
for (i=0; i<RSTRUCT(s)->len; i++) {
|
||||
VALUE slot;
|
||||
ID id;
|
||||
char *p;
|
||||
const char *p;
|
||||
|
||||
if (i > 0) {
|
||||
rb_str_cat2(str, ", ");
|
||||
|
@ -517,7 +517,7 @@ rb_struct_inspect(s)
|
|||
VALUE s;
|
||||
{
|
||||
if (rb_inspecting_p(s)) {
|
||||
char *cname = rb_class2name(rb_obj_class(s));
|
||||
const char *cname = rb_class2name(rb_obj_class(s));
|
||||
size_t len = strlen(cname) + 14;
|
||||
VALUE str = rb_str_new(0, len);
|
||||
|
||||
|
|
4
time.c
4
time.c
|
@ -171,7 +171,7 @@ time_timeval(time, interval)
|
|||
int interval;
|
||||
{
|
||||
struct timeval t;
|
||||
char *tstr = interval ? "time interval" : "time";
|
||||
const char *tstr = interval ? "time interval" : "time";
|
||||
|
||||
#ifndef NEGATIVE_TIME_T
|
||||
interval = 1;
|
||||
|
@ -279,7 +279,7 @@ time_s_at(argc, argv, klass)
|
|||
return t;
|
||||
}
|
||||
|
||||
static char *months [12] = {
|
||||
static const char months[][4] = {
|
||||
"jan", "feb", "mar", "apr", "may", "jun",
|
||||
"jul", "aug", "sep", "oct", "nov", "dec",
|
||||
};
|
||||
|
|
2
util.c
2
util.c
|
@ -3100,7 +3100,7 @@ rv_alloc(int i)
|
|||
}
|
||||
|
||||
static char *
|
||||
nrv_alloc(char *s, char **rve, int n)
|
||||
nrv_alloc(const char *s, char **rve, int n)
|
||||
{
|
||||
char *rv, *t;
|
||||
|
||||
|
|
10
variable.c
10
variable.c
|
@ -195,7 +195,7 @@ rb_class_path(klass)
|
|||
return path;
|
||||
}
|
||||
else {
|
||||
char *s = "Class";
|
||||
const char *s = "Class";
|
||||
size_t len;
|
||||
|
||||
if (TYPE(klass) == T_MODULE) {
|
||||
|
@ -294,14 +294,14 @@ rb_class_name(klass)
|
|||
return rb_class_path(rb_class_real(klass));
|
||||
}
|
||||
|
||||
char *
|
||||
const char *
|
||||
rb_class2name(klass)
|
||||
VALUE klass;
|
||||
{
|
||||
return RSTRING(rb_class_name(klass))->ptr;
|
||||
}
|
||||
|
||||
char *
|
||||
const char *
|
||||
rb_obj_classname(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
|
@ -789,7 +789,7 @@ rb_f_global_variables()
|
|||
{
|
||||
VALUE ary = rb_ary_new();
|
||||
char buf[4];
|
||||
char *s = "&`'+123456789";
|
||||
const char *s = "&`'+123456789";
|
||||
|
||||
st_foreach(rb_global_tbl, gvar_i, ary);
|
||||
if (!NIL_P(rb_backref_get())) {
|
||||
|
@ -1653,7 +1653,7 @@ mod_av_set(klass, id, val, isconst)
|
|||
VALUE val;
|
||||
int isconst;
|
||||
{
|
||||
char *dest = isconst ? "constant" : "class variable";
|
||||
const char *dest = isconst ? "constant" : "class variable";
|
||||
|
||||
if (!OBJ_TAINTED(klass) && rb_safe_level() >= 4)
|
||||
rb_raise(rb_eSecurityError, "Insecure: can't set %s", dest);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue