mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* dir.c: supress warning "/* within comment"
* bignum.c, io.c, math.c, pack.c, time.c: ANSI styled. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5ed418b594
commit
2b25baff72
7 changed files with 42 additions and 56 deletions
|
@ -7,8 +7,8 @@ Wed Mar 1 00:15:51 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
|
||||||
Fri Feb 24 20:21:38 2006 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
|
Fri Feb 24 20:21:38 2006 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
|
||||||
|
|
||||||
* test/drb/drbtest.rb (add_service_command): quote pathnames in the
|
* test/drb/drbtest.rb (add_service_command): quote pathnames in the
|
||||||
server's command line for space contained directory names.
|
server's command line for space contained directory names.
|
||||||
Thanks, arton. [ruby-dev:28386]
|
Thanks, arton. [ruby-dev:28386]
|
||||||
|
|
||||||
Fri Feb 24 12:10:07 2006 NAKAMURA Usaku <usa@ruby-lang.org>
|
Fri Feb 24 12:10:07 2006 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
|
|
8
bignum.c
8
bignum.c
|
@ -249,9 +249,7 @@ rb_quad_unpack(const char *buf, int sign)
|
||||||
#define QUAD_SIZE 8
|
#define QUAD_SIZE 8
|
||||||
|
|
||||||
void
|
void
|
||||||
rb_quad_pack(buf, val)
|
rb_quad_pack(char *buf, VALUE val)
|
||||||
char *buf;
|
|
||||||
VALUE val;
|
|
||||||
{
|
{
|
||||||
long len;
|
long len;
|
||||||
|
|
||||||
|
@ -277,9 +275,7 @@ rb_quad_pack(buf, val)
|
||||||
#define BNEG(b) (RSHIFT(((BDIGIT*)b)[QUAD_SIZE/SIZEOF_BDIGITS-1],BITSPERDIG-1) != 0)
|
#define BNEG(b) (RSHIFT(((BDIGIT*)b)[QUAD_SIZE/SIZEOF_BDIGITS-1],BITSPERDIG-1) != 0)
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
rb_quad_unpack(buf, sign)
|
rb_quad_unpack(const char *buf, int sign)
|
||||||
const char *buf;
|
|
||||||
int sign;
|
|
||||||
{
|
{
|
||||||
VALUE big = bignew(QUAD_SIZE/SIZEOF_BDIGITS, 1);
|
VALUE big = bignew(QUAD_SIZE/SIZEOF_BDIGITS, 1);
|
||||||
|
|
||||||
|
|
18
dir.c
18
dir.c
|
@ -1745,7 +1745,7 @@ dir_entries(VALUE io, VALUE dirname)
|
||||||
* File.fnmatch('*', '.profile', File::FNM_DOTMATCH) #=> true period by default.
|
* File.fnmatch('*', '.profile', File::FNM_DOTMATCH) #=> true period by default.
|
||||||
* File.fnmatch('.*', '.profile') #=> true
|
* File.fnmatch('.*', '.profile') #=> true
|
||||||
*
|
*
|
||||||
* rbfiles = File.join("**", "*.rb")
|
* rbfiles = '**' '/' '*.rb' # you don't have to do like this. just write in single string.
|
||||||
* File.fnmatch(rbfiles, 'main.rb') #=> false
|
* File.fnmatch(rbfiles, 'main.rb') #=> false
|
||||||
* File.fnmatch(rbfiles, './main.rb') #=> false
|
* File.fnmatch(rbfiles, './main.rb') #=> false
|
||||||
* File.fnmatch(rbfiles, 'lib/song.rb') #=> true
|
* File.fnmatch(rbfiles, 'lib/song.rb') #=> true
|
||||||
|
@ -1754,14 +1754,16 @@ dir_entries(VALUE io, VALUE dirname)
|
||||||
* File.fnmatch('**.rb', 'lib/song.rb') #=> true
|
* File.fnmatch('**.rb', 'lib/song.rb') #=> true
|
||||||
* File.fnmatch('*', 'dave/.profile') #=> true
|
* File.fnmatch('*', 'dave/.profile') #=> true
|
||||||
*
|
*
|
||||||
* File.fnmatch('* IGNORE /*', 'dave/.profile', File::FNM_PATHNAME) #=> false
|
* pattern = '*' '/' '*'
|
||||||
* File.fnmatch('* IGNORE /*', 'dave/.profile', File::FNM_PATHNAME | File::FNM_DOTMATCH) #=> true
|
* File.fnmatch(pattern, 'dave/.profile', File::FNM_PATHNAME) #=> false
|
||||||
|
* File.fnmatch(pattern, 'dave/.profile', File::FNM_PATHNAME | File::FNM_DOTMATCH) #=> true
|
||||||
*
|
*
|
||||||
* File.fnmatch('** IGNORE /foo', 'a/b/c/foo', File::FNM_PATHNAME) #=> true
|
* pattern = '**' '/' 'foo'
|
||||||
* File.fnmatch('** IGNORE /foo', '/a/b/c/foo', File::FNM_PATHNAME) #=> true
|
* File.fnmatch(pattern, 'a/b/c/foo', File::FNM_PATHNAME) #=> true
|
||||||
* File.fnmatch('** IGNORE /foo', 'c:/a/b/c/foo', File::FNM_PATHNAME) #=> true
|
* File.fnmatch(pattern, '/a/b/c/foo', File::FNM_PATHNAME) #=> true
|
||||||
* File.fnmatch('** IGNORE /foo', 'a/.b/c/foo', File::FNM_PATHNAME) #=> false
|
* File.fnmatch(pattern, 'c:/a/b/c/foo', File::FNM_PATHNAME) #=> true
|
||||||
* File.fnmatch('** IGNORE /foo', 'a/.b/c/foo', File::FNM_PATHNAME | File::FNM_DOTMATCH) #=> true
|
* File.fnmatch(pattern, 'a/.b/c/foo', File::FNM_PATHNAME) #=> false
|
||||||
|
* File.fnmatch(pattern, 'a/.b/c/foo', File::FNM_PATHNAME | File::FNM_DOTMATCH) #=> true
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
file_s_fnmatch(int argc, VALUE *argv, VALUE obj)
|
file_s_fnmatch(int argc, VALUE *argv, VALUE obj)
|
||||||
|
|
21
io.c
21
io.c
|
@ -455,8 +455,7 @@ io_fflush(OpenFile *fptr)
|
||||||
|
|
||||||
#ifdef HAVE_RB_FD_INIT
|
#ifdef HAVE_RB_FD_INIT
|
||||||
static VALUE
|
static VALUE
|
||||||
wait_readable(p)
|
wait_readable(VALUE p)
|
||||||
VALUE p;
|
|
||||||
{
|
{
|
||||||
rb_fdset_t *rfds = (rb_fdset_t *)p;
|
rb_fdset_t *rfds = (rb_fdset_t *)p;
|
||||||
|
|
||||||
|
@ -498,8 +497,7 @@ rb_io_wait_readable(int f)
|
||||||
|
|
||||||
#ifdef HAVE_RB_FD_INIT
|
#ifdef HAVE_RB_FD_INIT
|
||||||
static VALUE
|
static VALUE
|
||||||
wait_writable(p)
|
wait_writable(VALUE p)
|
||||||
VALUE p;
|
|
||||||
{
|
{
|
||||||
rb_fdset_t *wfds = (rb_fdset_t *)p;
|
rb_fdset_t *wfds = (rb_fdset_t *)p;
|
||||||
|
|
||||||
|
@ -2805,8 +2803,7 @@ popen_redirect(struct popen_arg *p)
|
||||||
|
|
||||||
#ifdef HAVE_FORK
|
#ifdef HAVE_FORK
|
||||||
static int
|
static int
|
||||||
popen_exec(p)
|
popen_exec(struct popen_arg *p)
|
||||||
struct popen_arg *p;
|
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
|
@ -2823,7 +2820,7 @@ popen_exec(p)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
pipe_open(int argc, VALUE *argv, char *mode)
|
pipe_open(int argc, VALUE *argv, const char *mode)
|
||||||
{
|
{
|
||||||
int modef = rb_io_mode_flags(mode);
|
int modef = rb_io_mode_flags(mode);
|
||||||
int pid = 0;
|
int pid = 0;
|
||||||
|
@ -3255,7 +3252,7 @@ rb_f_open(int argc, VALUE *argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
rb_io_open(char *fname, char *mode)
|
rb_io_open(const char *fname, const char *mode)
|
||||||
{
|
{
|
||||||
if (fname[0] == '|') {
|
if (fname[0] == '|') {
|
||||||
VALUE cmd = rb_str_new2(fname+1);
|
VALUE cmd = rb_str_new2(fname+1);
|
||||||
|
@ -3725,7 +3722,7 @@ rb_f_puts(int argc, VALUE *argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rb_p(VALUE obj) /* for debug print within C code */
|
rb_p(VALUE obj) /* for debug print within C code */
|
||||||
{
|
{
|
||||||
rb_io_write(rb_stdout, rb_obj_as_string(rb_inspect(obj)));
|
rb_io_write(rb_stdout, rb_obj_as_string(rb_inspect(obj)));
|
||||||
rb_io_write(rb_stdout, rb_default_rs);
|
rb_io_write(rb_stdout, rb_default_rs);
|
||||||
|
@ -4515,8 +4512,7 @@ struct select_args {
|
||||||
|
|
||||||
#ifdef HAVE_RB_FD_INIT
|
#ifdef HAVE_RB_FD_INIT
|
||||||
static VALUE
|
static VALUE
|
||||||
select_call(arg)
|
select_call(VALUE arg)
|
||||||
VALUE arg;
|
|
||||||
{
|
{
|
||||||
struct select_args *p = (struct select_args *)arg;
|
struct select_args *p = (struct select_args *)arg;
|
||||||
|
|
||||||
|
@ -4524,8 +4520,7 @@ select_call(arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
select_end(arg)
|
select_end(VALUE arg)
|
||||||
VALUE arg;
|
|
||||||
{
|
{
|
||||||
struct select_args *p = (struct select_args *)arg;
|
struct select_args *p = (struct select_args *)arg;
|
||||||
int i;
|
int i;
|
||||||
|
|
9
math.c
9
math.c
|
@ -146,8 +146,7 @@ math_atan(VALUE obj, VALUE x)
|
||||||
|
|
||||||
#ifndef HAVE_COSH
|
#ifndef HAVE_COSH
|
||||||
double
|
double
|
||||||
cosh(x)
|
cosh(double x)
|
||||||
double x;
|
|
||||||
{
|
{
|
||||||
return (exp(x) + exp(-x)) / 2;
|
return (exp(x) + exp(-x)) / 2;
|
||||||
}
|
}
|
||||||
|
@ -170,8 +169,7 @@ math_cosh(VALUE obj, VALUE x)
|
||||||
|
|
||||||
#ifndef HAVE_SINH
|
#ifndef HAVE_SINH
|
||||||
double
|
double
|
||||||
sinh(x)
|
sinh(double x)
|
||||||
double x;
|
|
||||||
{
|
{
|
||||||
return (exp(x) - exp(-x)) / 2;
|
return (exp(x) - exp(-x)) / 2;
|
||||||
}
|
}
|
||||||
|
@ -194,8 +192,7 @@ math_sinh(VALUE obj, VALUE x)
|
||||||
|
|
||||||
#ifndef HAVE_TANH
|
#ifndef HAVE_TANH
|
||||||
double
|
double
|
||||||
tanh(x)
|
tanh(double x)
|
||||||
double x;
|
|
||||||
{
|
{
|
||||||
return sinh(x) / cosh(x);
|
return sinh(x) / cosh(x);
|
||||||
}
|
}
|
||||||
|
|
32
pack.c
32
pack.c
|
@ -152,8 +152,7 @@ swapd(const double d)
|
||||||
#else
|
#else
|
||||||
#if SIZEOF_SHORT == 4 /* SIZEOF_DOUBLE == 8 && 4 == SIZEOF_SHORT */
|
#if SIZEOF_SHORT == 4 /* SIZEOF_DOUBLE == 8 && 4 == SIZEOF_SHORT */
|
||||||
static double
|
static double
|
||||||
swapd(d)
|
swapd(const double d)
|
||||||
const double d;
|
|
||||||
{
|
{
|
||||||
double dtmp = d;
|
double dtmp = d;
|
||||||
unsigned short utmp[2];
|
unsigned short utmp[2];
|
||||||
|
@ -186,7 +185,7 @@ define_swapx(d, double)
|
||||||
#undef htonl
|
#undef htonl
|
||||||
#endif
|
#endif
|
||||||
static int
|
static int
|
||||||
endian()
|
endian(void)
|
||||||
{
|
{
|
||||||
static int init = 0;
|
static int init = 0;
|
||||||
static int endian_value;
|
static int endian_value;
|
||||||
|
@ -362,13 +361,12 @@ num2i32(VALUE x)
|
||||||
#else
|
#else
|
||||||
# define QUAD_SIZE 8
|
# define QUAD_SIZE 8
|
||||||
#endif
|
#endif
|
||||||
static 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 void qpencode(VALUE,VALUE,long);
|
||||||
|
|
||||||
static int uv_to_utf8(char*,unsigned long);
|
static int uv_to_utf8(char*,unsigned long);
|
||||||
static unsigned long utf8_to_uv(char*,long*);
|
static unsigned long utf8_to_uv(const char*,long*);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
|
@ -438,13 +436,13 @@ static unsigned long utf8_to_uv(char*,long*);
|
||||||
static VALUE
|
static VALUE
|
||||||
pack_pack(VALUE ary, VALUE fmt)
|
pack_pack(VALUE ary, VALUE fmt)
|
||||||
{
|
{
|
||||||
static char *nul10 = "\0\0\0\0\0\0\0\0\0\0";
|
static const char nul10[] = "\0\0\0\0\0\0\0\0\0\0";
|
||||||
static char *spc10 = " ";
|
static const char spc10[] = " ";
|
||||||
char *p, *pend;
|
const char *p, *pend;
|
||||||
VALUE res, from, associates = 0;
|
VALUE res, from, associates = 0;
|
||||||
char type;
|
char type;
|
||||||
long items, len, idx, plen;
|
long items, len, idx, plen;
|
||||||
char *ptr;
|
const char *ptr;
|
||||||
#ifdef NATINT_PACK
|
#ifdef NATINT_PACK
|
||||||
int natint; /* native integer */
|
int natint; /* native integer */
|
||||||
#endif
|
#endif
|
||||||
|
@ -458,7 +456,7 @@ pack_pack(VALUE ary, VALUE fmt)
|
||||||
idx = 0;
|
idx = 0;
|
||||||
|
|
||||||
#define THISFROM RARRAY(ary)->ptr[idx]
|
#define THISFROM RARRAY(ary)->ptr[idx]
|
||||||
#define NEXTFROM (items-- > 0 ? RARRAY(ary)->ptr[idx++] : (rb_raise(rb_eArgError, toofew),0))
|
#define NEXTFROM (items-- > 0 ? RARRAY(ary)->ptr[idx++] : (rb_raise(rb_eArgError, "too few arguments"),0))
|
||||||
|
|
||||||
while (p < pend) {
|
while (p < pend) {
|
||||||
if (RSTRING(fmt)->ptr + RSTRING(fmt)->len != pend) {
|
if (RSTRING(fmt)->ptr + RSTRING(fmt)->len != pend) {
|
||||||
|
@ -999,17 +997,17 @@ pack_pack(VALUE ary, VALUE fmt)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char uu_table[] =
|
static const char uu_table[] =
|
||||||
"`!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_";
|
"`!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_";
|
||||||
static char b64_table[] =
|
static const char b64_table[] =
|
||||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||||
|
|
||||||
static void
|
static void
|
||||||
encodes(VALUE str, char *s, long len, int type)
|
encodes(VALUE str, const char *s, long len, int type)
|
||||||
{
|
{
|
||||||
char *buff = ALLOCA_N(char, len * 4 / 3 + 6);
|
char *buff = ALLOCA_N(char, len * 4 / 3 + 6);
|
||||||
long i = 0;
|
long i = 0;
|
||||||
char *trans = type == 'u' ? uu_table : b64_table;
|
const char *trans = type == 'u' ? uu_table : b64_table;
|
||||||
int padding;
|
int padding;
|
||||||
|
|
||||||
if (type == 'u') {
|
if (type == 'u') {
|
||||||
|
@ -1043,7 +1041,7 @@ encodes(VALUE str, char *s, long len, int type)
|
||||||
rb_str_buf_cat(str, buff, i);
|
rb_str_buf_cat(str, buff, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char hex_table[] = "0123456789ABCDEF";
|
static const char hex_table[] = "0123456789ABCDEF";
|
||||||
|
|
||||||
static void
|
static void
|
||||||
qpencode(VALUE str, VALUE from, long len)
|
qpencode(VALUE str, VALUE from, long len)
|
||||||
|
@ -2031,7 +2029,7 @@ static const unsigned long utf8_limits[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static unsigned long
|
static unsigned long
|
||||||
utf8_to_uv(char *p, long *lenp)
|
utf8_to_uv(const char *p, long *lenp)
|
||||||
{
|
{
|
||||||
int c = *p++ & 0xff;
|
int c = *p++ & 0xff;
|
||||||
unsigned long uv = c;
|
unsigned long uv = c;
|
||||||
|
|
6
time.c
6
time.c
|
@ -260,7 +260,7 @@ time_s_at(int argc, VALUE *argv, VALUE klass)
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *months [12] = {
|
static const char *months[] = {
|
||||||
"jan", "feb", "mar", "apr", "may", "jun",
|
"jan", "feb", "mar", "apr", "may", "jun",
|
||||||
"jul", "aug", "sep", "oct", "nov", "dec",
|
"jul", "aug", "sep", "oct", "nov", "dec",
|
||||||
};
|
};
|
||||||
|
@ -1773,9 +1773,7 @@ time_to_a(VALUE time)
|
||||||
|
|
||||||
#define SMALLBUF 100
|
#define SMALLBUF 100
|
||||||
static int
|
static int
|
||||||
rb_strftime(char **buf,
|
rb_strftime(char **buf, const char *format, struct tm *time)
|
||||||
const char *format,
|
|
||||||
struct tm *time)
|
|
||||||
{
|
{
|
||||||
int size, len, flen;
|
int size, len, flen;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue