summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-03-01 10:06:03 +0000
committerocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-03-01 10:06:03 +0000
commit2b25baff72412deb6075fe3a3bcba3bf7d0e8401 (patch)
tree425832b33246e19d77897127da20b89ea19b92c6
parent5ed418b594ad4e45fb6ac302fbb93a2a610e43ff (diff)
* 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
-rw-r--r--ChangeLog4
-rw-r--r--bignum.c8
-rw-r--r--dir.c18
-rw-r--r--io.c21
-rw-r--r--math.c9
-rw-r--r--pack.c32
-rw-r--r--time.c6
7 files changed, 42 insertions, 56 deletions
diff --git a/ChangeLog b/ChangeLog
index cfb92d971e..3f0b1530ac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
* test/drb/drbtest.rb (add_service_command): quote pathnames in the
- server's command line for space contained directory names.
- Thanks, arton. [ruby-dev:28386]
+ server's command line for space contained directory names.
+ Thanks, arton. [ruby-dev:28386]
Fri Feb 24 12:10:07 2006 NAKAMURA Usaku <usa@ruby-lang.org>
diff --git a/bignum.c b/bignum.c
index 9cf7a3702f..4c070c5c45 100644
--- a/bignum.c
+++ b/bignum.c
@@ -249,9 +249,7 @@ rb_quad_unpack(const char *buf, int sign)
#define QUAD_SIZE 8
void
-rb_quad_pack(buf, val)
- char *buf;
- VALUE val;
+rb_quad_pack(char *buf, VALUE val)
{
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)
VALUE
-rb_quad_unpack(buf, sign)
- const char *buf;
- int sign;
+rb_quad_unpack(const char *buf, int sign)
{
VALUE big = bignew(QUAD_SIZE/SIZEOF_BDIGITS, 1);
diff --git a/dir.c b/dir.c
index f6779a84c2..42668d338f 100644
--- a/dir.c
+++ b/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') #=> 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, 'lib/song.rb') #=> true
@@ -1754,14 +1754,16 @@ dir_entries(VALUE io, VALUE dirname)
* File.fnmatch('**.rb', 'lib/song.rb') #=> true
* File.fnmatch('*', 'dave/.profile') #=> true
*
- * File.fnmatch('* IGNORE /*', 'dave/.profile', File::FNM_PATHNAME) #=> false
- * File.fnmatch('* IGNORE /*', 'dave/.profile', File::FNM_PATHNAME | File::FNM_DOTMATCH) #=> true
+ * pattern = '*' '/' '*'
+ * 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
- * File.fnmatch('** IGNORE /foo', '/a/b/c/foo', File::FNM_PATHNAME) #=> true
- * File.fnmatch('** IGNORE /foo', 'c:/a/b/c/foo', File::FNM_PATHNAME) #=> true
- * File.fnmatch('** IGNORE /foo', 'a/.b/c/foo', File::FNM_PATHNAME) #=> false
- * File.fnmatch('** IGNORE /foo', 'a/.b/c/foo', File::FNM_PATHNAME | File::FNM_DOTMATCH) #=> true
+ * pattern = '**' '/' 'foo'
+ * File.fnmatch(pattern, 'a/b/c/foo', File::FNM_PATHNAME) #=> true
+ * File.fnmatch(pattern, '/a/b/c/foo', File::FNM_PATHNAME) #=> true
+ * File.fnmatch(pattern, 'c:/a/b/c/foo', File::FNM_PATHNAME) #=> 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
file_s_fnmatch(int argc, VALUE *argv, VALUE obj)
diff --git a/io.c b/io.c
index e00325fa0d..5d72af16bc 100644
--- a/io.c
+++ b/io.c
@@ -455,8 +455,7 @@ io_fflush(OpenFile *fptr)
#ifdef HAVE_RB_FD_INIT
static VALUE
-wait_readable(p)
- VALUE p;
+wait_readable(VALUE p)
{
rb_fdset_t *rfds = (rb_fdset_t *)p;
@@ -498,8 +497,7 @@ rb_io_wait_readable(int f)
#ifdef HAVE_RB_FD_INIT
static VALUE
-wait_writable(p)
- VALUE p;
+wait_writable(VALUE p)
{
rb_fdset_t *wfds = (rb_fdset_t *)p;
@@ -2805,8 +2803,7 @@ popen_redirect(struct popen_arg *p)
#ifdef HAVE_FORK
static int
-popen_exec(p)
- struct popen_arg *p;
+popen_exec(struct popen_arg *p)
{
int fd;
@@ -2823,7 +2820,7 @@ popen_exec(p)
#endif
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 pid = 0;
@@ -3255,7 +3252,7 @@ rb_f_open(int argc, VALUE *argv)
}
static VALUE
-rb_io_open(char *fname, char *mode)
+rb_io_open(const char *fname, const char *mode)
{
if (fname[0] == '|') {
VALUE cmd = rb_str_new2(fname+1);
@@ -3725,7 +3722,7 @@ rb_f_puts(int argc, VALUE *argv)
}
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_default_rs);
@@ -4515,8 +4512,7 @@ struct select_args {
#ifdef HAVE_RB_FD_INIT
static VALUE
-select_call(arg)
- VALUE arg;
+select_call(VALUE arg)
{
struct select_args *p = (struct select_args *)arg;
@@ -4524,8 +4520,7 @@ select_call(arg)
}
static VALUE
-select_end(arg)
- VALUE arg;
+select_end(VALUE arg)
{
struct select_args *p = (struct select_args *)arg;
int i;
diff --git a/math.c b/math.c
index 9235cb1306..47f8dd5710 100644
--- a/math.c
+++ b/math.c
@@ -146,8 +146,7 @@ math_atan(VALUE obj, VALUE x)
#ifndef HAVE_COSH
double
-cosh(x)
- double x;
+cosh(double x)
{
return (exp(x) + exp(-x)) / 2;
}
@@ -170,8 +169,7 @@ math_cosh(VALUE obj, VALUE x)
#ifndef HAVE_SINH
double
-sinh(x)
- double x;
+sinh(double x)
{
return (exp(x) - exp(-x)) / 2;
}
@@ -194,8 +192,7 @@ math_sinh(VALUE obj, VALUE x)
#ifndef HAVE_TANH
double
-tanh(x)
- double x;
+tanh(double x)
{
return sinh(x) / cosh(x);
}
diff --git a/pack.c b/pack.c
index b98a1209e3..220ed970d3 100644
--- a/pack.c
+++ b/pack.c
@@ -152,8 +152,7 @@ swapd(const double d)
#else
#if SIZEOF_SHORT == 4 /* SIZEOF_DOUBLE == 8 && 4 == SIZEOF_SHORT */
static double
-swapd(d)
- const double d;
+swapd(const double d)
{
double dtmp = d;
unsigned short utmp[2];
@@ -186,7 +185,7 @@ define_swapx(d, double)
#undef htonl
#endif
static int
-endian()
+endian(void)
{
static int init = 0;
static int endian_value;
@@ -362,13 +361,12 @@ num2i32(VALUE x)
#else
# define QUAD_SIZE 8
#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 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:
@@ -438,13 +436,13 @@ static unsigned long utf8_to_uv(char*,long*);
static VALUE
pack_pack(VALUE ary, VALUE fmt)
{
- static char *nul10 = "\0\0\0\0\0\0\0\0\0\0";
- static char *spc10 = " ";
- char *p, *pend;
+ static const char nul10[] = "\0\0\0\0\0\0\0\0\0\0";
+ static const char spc10[] = " ";
+ const 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
@@ -458,7 +456,7 @@ pack_pack(VALUE ary, VALUE fmt)
idx = 0;
#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) {
if (RSTRING(fmt)->ptr + RSTRING(fmt)->len != pend) {
@@ -999,17 +997,17 @@ pack_pack(VALUE ary, VALUE 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(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);
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') {
@@ -1043,7 +1041,7 @@ encodes(VALUE str, char *s, long len, int type)
rb_str_buf_cat(str, buff, i);
}
-static char hex_table[] = "0123456789ABCDEF";
+static const char hex_table[] = "0123456789ABCDEF";
static void
qpencode(VALUE str, VALUE from, long len)
@@ -2031,7 +2029,7 @@ static const unsigned long utf8_limits[] = {
};
static unsigned long
-utf8_to_uv(char *p, long *lenp)
+utf8_to_uv(const char *p, long *lenp)
{
int c = *p++ & 0xff;
unsigned long uv = c;
diff --git a/time.c b/time.c
index 666199dd0a..88a5fedacc 100644
--- a/time.c
+++ b/time.c
@@ -260,7 +260,7 @@ time_s_at(int argc, VALUE *argv, VALUE klass)
return t;
}
-static char *months [12] = {
+static const char *months[] = {
"jan", "feb", "mar", "apr", "may", "jun",
"jul", "aug", "sep", "oct", "nov", "dec",
};
@@ -1773,9 +1773,7 @@ time_to_a(VALUE time)
#define SMALLBUF 100
static int
-rb_strftime(char **buf,
- const char *format,
- struct tm *time)
+rb_strftime(char **buf, const char *format, struct tm *time)
{
int size, len, flen;