summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bignum.c6
-rw-r--r--class.c6
-rw-r--r--error.c2
-rw-r--r--eval.c13
-rw-r--r--file.c9
-rw-r--r--hash.c8
-rw-r--r--intern.h2
-rw-r--r--io.c7
-rw-r--r--marshal.c2
-rw-r--r--object.c5
-rw-r--r--pack.c19
-rw-r--r--parse.y50
-rw-r--r--process.c9
-rw-r--r--re.c1
-rw-r--r--regex.c6
-rw-r--r--ruby.c19
-rw-r--r--ruby.h12
-rw-r--r--sig.h3
-rw-r--r--sprintf.c13
-rw-r--r--string.c34
-rw-r--r--struct.c5
-rw-r--r--util.c3
-rw-r--r--util.h4
-rw-r--r--variable.c2
24 files changed, 99 insertions, 141 deletions
diff --git a/bignum.c b/bignum.c
index cce2327..fbf5543 100644
--- a/bignum.c
+++ b/bignum.c
@@ -9,8 +9,8 @@
************************************************/
#include "ruby.h"
-#include <ctype.h>
#include <math.h>
+#include <ctype.h>
extern VALUE cInteger;
VALUE cBignum;
@@ -175,7 +175,7 @@ str2inum(str, base)
VALUE z;
USHORT *zds;
- while (isspace(*str)) str++;
+ while (ISSPACE(*str)) str++;
if (*str == '-') {
str++;
sign = 0;
@@ -1108,7 +1108,7 @@ big_xor(x, y)
return bignorm(z);
}
-static VALUE big_rshift();
+static VALUE big_rshift _((VALUE,VALUE));
VALUE
big_lshift(x, y)
diff --git a/class.c b/class.c
index 2289492..28d11de 100644
--- a/class.c
+++ b/class.c
@@ -18,7 +18,6 @@
#include <stdio.h>
#endif
-struct st_table *new_idhash();
extern st_table *rb_class_tbl;
extern VALUE cClass;
@@ -572,7 +571,6 @@ rb_define_attr(klass, name, read, write)
#include <varargs.h>
#define va_init_list(a,b) va_start(a)
#endif
-#include <ctype.h>
int
#ifdef HAVE_STDARG_PROTOTYPES
@@ -598,7 +596,7 @@ rb_scan_args(argc, argv, fmt, va_alist)
return argc;
}
- if (isdigit(*p)) {
+ if (ISDIGIT(*p)) {
n = *p - '0';
if (n > argc)
ArgError("Wrong # of arguments (%d for %d)", argc, n);
@@ -612,7 +610,7 @@ rb_scan_args(argc, argv, fmt, va_alist)
goto error;
}
- if (isdigit(*p)) {
+ if (ISDIGIT(*p)) {
n = i + *p - '0';
for (; i<n; i++) {
var = va_arg(vargs, VALUE*);
diff --git a/error.c b/error.c
index 41578c9..ad93675 100644
--- a/error.c
+++ b/error.c
@@ -507,7 +507,7 @@ syserr_errno(self)
return rb_iv_get(self, "errno");
}
-static void init_syserr();
+static void init_syserr _((void));
void
Init_Exception()
diff --git a/eval.c b/eval.c
index 75cbb24..84176dd 100644
--- a/eval.c
+++ b/eval.c
@@ -4152,8 +4152,8 @@ rb_provided(feature)
}
#ifdef THREAD
-static int thread_loading();
-static void thread_loading_done();
+static int thread_loading _((char*));
+static void thread_loading_done _((void));
#endif
void
@@ -5407,11 +5407,6 @@ thread_check(data)
return (thread_t)RDATA(data)->data;
}
-VALUE lastline_get();
-void lastline_set();
-VALUE backref_get();
-void backref_set();
-
static void
thread_save_context(th)
thread_t th;
@@ -5447,7 +5442,7 @@ thread_save_context(th)
th->line = sourceline;
}
-static void thread_restore_context();
+static void thread_restore_context _((thread_t,int));
static void
stack_extend(th, exit)
@@ -5811,7 +5806,7 @@ thread_wait_for(time)
thread_schedule();
}
-void thread_sleep_forever();
+void thread_sleep_forever _((void));
int
thread_alone()
diff --git a/file.c b/file.c
index 2404211..4ea5871 100644
--- a/file.c
+++ b/file.c
@@ -43,17 +43,12 @@ struct timeval {
#endif
#ifndef HAVE_STRING_H
-char *strrchr();
+char *strrchr _((char*,char));
#endif
#include <sys/types.h>
#include <sys/stat.h>
-#ifndef NT
-char *strdup();
-char *getenv();
-#endif
-
#ifdef USE_CWGUSI
#include "macruby_missing.h"
extern int fileno(FILE *stream);
@@ -65,8 +60,6 @@ VALUE cFile;
VALUE mFileTest;
static VALUE sStat;
-VALUE time_new();
-
VALUE
file_open(fname, mode)
char *fname, *mode;
diff --git a/hash.c b/hash.c
index ab84569..4a97c62 100644
--- a/hash.c
+++ b/hash.c
@@ -18,7 +18,7 @@
#include <sys/stat.h>
#ifndef HAVE_STRING_H
-char *strchr();
+char *strchr _((char*,char));
#endif
#define HASH_FREEZE FL_USER1
@@ -51,10 +51,6 @@ hash_frozen_p(hash)
return FALSE;
}
-#ifndef NT
-char *getenv();
-#endif
-
VALUE cHash;
static VALUE envtbl;
@@ -775,8 +771,6 @@ hash_update(hash1, hash2)
}
#ifndef __MACOS__ /* environment variables nothing on MacOS. */
-
-int env_path_tainted();
static int path_tainted = -1;
#ifndef NT
diff --git a/intern.h b/intern.h
index 78d249b..8a31d95 100644
--- a/intern.h
+++ b/intern.h
@@ -151,6 +151,7 @@ VALUE rb_hash _((VALUE));
VALUE hash_new _((void));
VALUE hash_aref _((VALUE, VALUE));
VALUE hash_aset _((VALUE, VALUE, VALUE));
+int env_path_tainted _((void));
/* io.c */
void eof_error _((void));
VALUE io_write _((VALUE, VALUE));
@@ -273,6 +274,7 @@ void add_suffix _((VALUE, char*));
unsigned long scan_oct _((char*, int, int*));
unsigned long scan_hex _((char*, int, int*));
/* variable.c */
+struct st_table *new_idhash _((void));
VALUE mod_name _((VALUE));
VALUE rb_class_path _((VALUE));
void rb_set_class_path _((VALUE, VALUE, char*));
diff --git a/io.c b/io.c
index 14655c7..0dda83f 100644
--- a/io.c
+++ b/io.c
@@ -64,8 +64,6 @@ struct timeval {
#include <net/socket.h>
#endif
-VALUE rb_ad_string();
-
VALUE cIO;
extern VALUE cFile;
VALUE eEOFError;
@@ -81,12 +79,9 @@ static VALUE argf;
ID id_write;
-VALUE lastline_get();
-void lastline_set();
-
extern char *inplace;
-struct timeval time_timeval();
+struct timeval time_timeval _((VALUE));
#ifdef _STDIO_USES_IOSTREAM /* GNU libc */
# ifdef _IO_fpos_t
diff --git a/marshal.c b/marshal.c
index 3f604d0..49cdaa5 100644
--- a/marshal.c
+++ b/marshal.c
@@ -43,7 +43,7 @@ extern VALUE cRegexp;
extern VALUE cArray;
extern VALUE cHash;
-VALUE rb_path2class();
+VALUE rb_path2class _((char*));
static ID s_dump, s_load;
diff --git a/object.c b/object.c
index 0e3bfdf..5e63f82 100644
--- a/object.c
+++ b/object.c
@@ -29,10 +29,7 @@ static VALUE cNilClass;
static VALUE cTrueClass;
static VALUE cFalseClass;
-struct st_table *new_idhash();
-
VALUE f_sprintf();
-
VALUE obj_alloc();
static ID eq, eql;
@@ -785,7 +782,7 @@ rb_convert_type(val, type, tname, method)
return val;
}
-double big2dbl();
+double big2dbl _((VALUE));
VALUE
f_float(obj, arg)
diff --git a/pack.c b/pack.c
index 972bd88..38a1caa 100644
--- a/pack.c
+++ b/pack.c
@@ -11,8 +11,8 @@
************************************************/
#include "ruby.h"
-#include <ctype.h>
#include <sys/types.h>
+#include <ctype.h>
#define swaps(x) ((((x)&0xFF)<<8) + (((x)>>8)&0xFF))
#define swapl(x) ((((x)&0xFF)<<24) \
@@ -75,13 +75,10 @@ endian()
#endif
extern VALUE cString, cArray;
-#ifndef atof
-double atof();
-#endif
static char *toofew = "too few arguments";
-static void encodes();
+static void encodes _((VALUE,char*,int,int));
static void
pack_add_ptr(str, add)
@@ -126,7 +123,7 @@ pack_pack(ary, fmt)
len = strchr("@Xxu", type) ? 0 : items;
p++;
}
- else if (isdigit(*p)) {
+ else if (ISDIGIT(*p)) {
len = strtoul(p, (char**)&p, 10);
}
else {
@@ -222,8 +219,8 @@ pack_pack(ary, fmt)
int i;
for (i=0; i++ < len; ptr++) {
- if (isxdigit(*ptr)) {
- if (isalpha(*ptr))
+ if (ISXDIGIT(*ptr)) {
+ if (ISALPHA(*ptr))
byte |= (((*ptr & 15) + 9) & 15) << 4;
else
byte |= (*ptr & 15) << 4;
@@ -249,8 +246,8 @@ pack_pack(ary, fmt)
int i;
for (i=0; i++ < len; ptr++) {
- if (isxdigit(*ptr)) {
- if (isalpha(*ptr))
+ if (ISXDIGIT(*ptr)) {
+ if (ISALPHA(*ptr))
byte |= ((*ptr & 15) + 9) & 15;
else
byte |= *ptr & 15;
@@ -570,7 +567,7 @@ pack_unpack(str, fmt)
len = send - s;
p++;
}
- else if (isdigit(*p)) {
+ else if (ISDIGIT(*p)) {
len = strtoul(p, (char**)&p, 10);
}
else {
diff --git a/parse.y b/parse.y
index 6f3f815..ae966e8 100644
--- a/parse.y
+++ b/parse.y
@@ -1518,7 +1518,7 @@ terms : term
#include "regex.h"
#include "util.h"
-#define is_identchar(c) ((c)!=-1&&(isalnum(c) || (c) == '_' || ismbchar(c)))
+#define is_identchar(c) ((c)!=-1&&(ISALNUM(c) || (c) == '_' || ismbchar(c)))
static char *tokenbuf = NULL;
static int tokidx, toksiz = 0;
@@ -1769,7 +1769,7 @@ read_escape()
for (i=0; i<2; i++) {
buf[i] = nextc();
if (buf[i] == -1) goto eof;
- if (!isxdigit(buf[i])) {
+ if (!ISXDIGIT(buf[i])) {
pushback(buf[i]);
break;
}
@@ -2301,7 +2301,7 @@ retry:
return tOP_ASGN;
}
pushback(c);
- if (lex_state == EXPR_ARG && space_seen && !isspace(c)){
+ if (lex_state == EXPR_ARG && space_seen && !ISSPACE(c)){
arg_ambiguous();
lex_state = EXPR_BEG;
return tSTAR;
@@ -2327,7 +2327,7 @@ retry:
case '=':
if (lex_p == lex_pbeg + 1) {
/* skip embedded rd document */
- if (strncmp(lex_p, "begin", 5) == 0 && isspace(lex_p[5])) {
+ if (strncmp(lex_p, "begin", 5) == 0 && ISSPACE(lex_p[5])) {
for (;;) {
sourceline++;
lex_p = lex_pend;
@@ -2337,7 +2337,7 @@ retry:
return 0;
}
if (c != '=') continue;
- if (strncmp(lex_p, "end", 3) == 0 && isspace(lex_p[3])) {
+ if (strncmp(lex_p, "end", 3) == 0 && ISSPACE(lex_p[3])) {
break;
}
}
@@ -2370,7 +2370,7 @@ retry:
lex_state != EXPR_END && lex_state != EXPR_CLASS &&
(lex_state != EXPR_ARG || space_seen)) {
int c2 = nextc();
- if (!isspace(c2) && (strchr("\"'`", c2) || is_identchar(c2))) {
+ if (!ISSPACE(c2) && (strchr("\"'`", c2) || is_identchar(c2))) {
if (!lex_input) {
ArgError("here document not available");
}
@@ -2429,7 +2429,7 @@ retry:
return '?';
}
c = nextc();
- if (lex_state == EXPR_ARG && isspace(c)){
+ if (lex_state == EXPR_ARG && ISSPACE(c)){
pushback(c);
arg_ambiguous();
lex_state = EXPR_BEG;
@@ -2455,7 +2455,7 @@ retry:
return tOP_ASGN;
}
pushback(c);
- if (lex_state == EXPR_ARG && space_seen && !isspace(c)){
+ if (lex_state == EXPR_ARG && space_seen && !ISSPACE(c)){
arg_ambiguous();
lex_state = EXPR_BEG;
return tAMPER;
@@ -2494,7 +2494,7 @@ retry:
return tOP_ASGN;
}
if (lex_state == EXPR_ARG) {
- if (space_seen && !isspace(c)) {
+ if (space_seen && !ISSPACE(c)) {
arg_ambiguous();
}
else {
@@ -2502,7 +2502,7 @@ retry:
}
}
if (lex_state != EXPR_END) {
- if (isdigit(c)) {
+ if (ISDIGIT(c)) {
goto start_num;
}
pushback(c);
@@ -2528,7 +2528,7 @@ retry:
return tOP_ASGN;
}
if (lex_state == EXPR_ARG) {
- if (space_seen && !isspace(c)) {
+ if (space_seen && !ISSPACE(c)) {
arg_ambiguous();
}
else {
@@ -2536,7 +2536,7 @@ retry:
}
}
if (lex_state != EXPR_END) {
- if (isdigit(c)) {
+ if (ISDIGIT(c)) {
pushback(c);
c = '-';
goto start_num;
@@ -2559,7 +2559,7 @@ retry:
return tDOT2;
}
pushback(c);
- if (!isdigit(c)) {
+ if (!ISDIGIT(c)) {
lex_state = EXPR_DOT;
return '.';
}
@@ -2585,7 +2585,7 @@ retry:
/* hexadecimal */
while (c = nextc()) {
if (c == '_') continue;
- if (!isxdigit(c)) break;
+ if (!ISXDIGIT(c)) break;
tokadd(c);
}
pushback(c);
@@ -2631,7 +2631,7 @@ retry:
}
else {
int c0 = nextc();
- if (!isdigit(c0)) {
+ if (!ISDIGIT(c0)) {
pushback(c0);
goto decode_num;
}
@@ -2699,7 +2699,7 @@ retry:
return tCOLON2;
}
pushback(c);
- if (lex_state == EXPR_END || isspace(c)) {
+ if (lex_state == EXPR_END || ISSPACE(c)) {
lex_state = EXPR_BEG;
return ':';
}
@@ -2716,7 +2716,7 @@ retry:
return tOP_ASGN;
}
if (lex_state == EXPR_ARG) {
- if (space_seen && !isspace(c)) {
+ if (space_seen && !ISSPACE(c)) {
pushback(c);
arg_ambiguous();
return parse_regx('/', '/');
@@ -2804,7 +2804,7 @@ retry:
c = nextc();
quotation:
- if (!isalnum(c)) {
+ if (!ISALNUM(c)) {
term = c;
switch (c) {
case '\'':
@@ -2856,7 +2856,7 @@ retry:
return tOP_ASGN;
}
if (lex_state == EXPR_ARG) {
- if (space_seen && !isspace(c)) {
+ if (space_seen && !ISSPACE(c)) {
arg_ambiguous();
goto quotation;
}
@@ -2915,7 +2915,7 @@ retry:
case '1': case '2': case '3':
case '4': case '5': case '6':
case '7': case '8': case '9':
- while (isdigit(c)) {
+ while (ISDIGIT(c)) {
tokadd(c);
c = nextc();
}
@@ -2945,7 +2945,7 @@ retry:
break;
default:
- if (c != '_' && !isalpha(c) && !ismbchar(c)) {
+ if (c != '_' && !ISALPHA(c) && !ismbchar(c)) {
Error("Invalid char '%c' in expression", c);
goto retry;
}
@@ -3011,7 +3011,7 @@ retry:
else {
lex_state = EXPR_END;
}
- if (isupper(tok()[0])) {
+ if (ISUPPER(tok()[0])) {
result = tCONSTANT;
}
else if (toklast() == '!' || toklast() == '?') {
@@ -3066,7 +3066,7 @@ str_extend(list, term)
case '1': case '2': case '3':
case '4': case '5': case '6':
case '7': case '8': case '9':
- while (isdigit(c)) {
+ while (ISDIGIT(c)) {
tokadd(c);
c = nextc();
}
@@ -3993,7 +3993,7 @@ rb_intern(name)
id |= ID_INSTANCE;
break;
default:
- if (name[0] != '_' && !isalpha(name[0]) && !ismbchar(name[0])) {
+ if (name[0] != '_' && !ISALPHA(name[0]) && !ismbchar(name[0])) {
/* operator */
int i;
@@ -4020,7 +4020,7 @@ rb_intern(name)
id &= ~ID_SCOPE_MASK;
id |= ID_ATTRSET;
}
- else if (isupper(name[0])) {
+ else if (ISUPPER(name[0])) {
id |= ID_CONST;
}
else {
diff --git a/process.c b/process.c
index d641dc5..5dbaac5 100644
--- a/process.c
+++ b/process.c
@@ -14,7 +14,6 @@
#include "sig.h"
#include <stdio.h>
#include <errno.h>
-#include <ctype.h>
#include <signal.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
@@ -29,8 +28,9 @@ struct timeval {
};
#endif
#endif /* NT */
+#include <ctype.h>
-struct timeval time_timeval();
+struct timeval time_timeval _((VALUE));
#ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h>
@@ -252,7 +252,6 @@ after_exec()
#endif
extern char *dln_find_exe();
-int env_path_tainted();
static void
security(str)
@@ -364,7 +363,7 @@ rb_proc_exec(str)
security(str);
for (s=str; *s; s++) {
- if (*s != ' ' && !isalpha(*s) && strchr("*?{}[]<>()~&|\\$;'`\"\n",*s)) {
+ if (*s != ' ' && !ISALPHA(*s) && strchr("*?{}[]<>()~&|\\$;'`\"\n",*s)) {
#if defined(MSDOS)
int state;
before_exec();
@@ -489,7 +488,7 @@ proc_spawn(str)
int state;
for (s = str; *s; s++) {
- if (*s != ' ' && !isalpha(*s) && strchr("*?{}[]<>()~&|\\$;'`\"\n",*s)) {
+ if (*s != ' ' && !ISALPHA(*s) && strchr("*?{}[]<>()~&|\\$;'`\"\n",*s)) {
char *shell = dln_find_exe("sh", 0);
before_exec();
state = shell ? spawnl(P_WAIT, shell, "sh", "-c", str, (char *) NULL) : system(str) ;
diff --git a/re.c b/re.c
index 642e9b8..888c412 100644
--- a/re.c
+++ b/re.c
@@ -1047,7 +1047,6 @@ match_setter(val)
backref_set(val);
}
-VALUE any_to_s();
extern VALUE eStandardError;
void
diff --git a/regex.c b/regex.c
index 9a28afa..3036bdc 100644
--- a/regex.c
+++ b/regex.c
@@ -42,10 +42,6 @@
#define const
#endif
-#ifdef __MWERKS__
-#include "ruby.h"
-#else
-
#include "config.h"
#include "defines.h"
@@ -54,8 +50,6 @@ void *xcalloc P((unsigned long,unsigned long));
void *xrealloc P((void*,unsigned long));
void free P((void*));
-#endif
-
/* #define NO_ALLOCA /* try it out for now */
#ifndef NO_ALLOCA
/* Make alloca work the best possible way. */
diff --git a/ruby.c b/ruby.c
index 60cd9a2..6263156 100644
--- a/ruby.c
+++ b/ruby.c
@@ -16,9 +16,9 @@
#include "ruby.h"
#include "dln.h"
#include <stdio.h>
-#include <ctype.h>
#include <sys/types.h>
#include <fcntl.h>
+#include <ctype.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
@@ -35,9 +35,9 @@ void show_copyright();
#endif
#ifndef HAVE_STRING_H
-char *strchr();
-char *strrchr();
-char *strstr();
+char *strchr _((char*,char));
+char *strrchr _((char*,char));
+char *strstr _((char*,char*));
#endif
char *ruby_mktemp _((void));
@@ -61,7 +61,7 @@ extern int nerrs;
static int xflag = FALSE;
extern VALUE RS, RS_default, ORS, FS;
-static void load_stdin();
+static void load_stdin _((void));
static void load_file _((char *, int));
static void forbid_setid _((char *));
@@ -91,7 +91,6 @@ extern char *sourcefile;
#endif
extern VALUE rb_load_path;
-VALUE Frequire();
static FILE *e_fp;
static char *e_tmpname;
@@ -525,10 +524,10 @@ load_file(fname, script)
if (pend[-1] == '\n') pend--; /* chomp line */
if (pend[-1] == '\r') pend--;
*pend = '\0';
- while (p < pend && isspace(*p))
+ while (p < pend && ISSPACE(*p))
p++;
path = p; /* interpreter path */
- while (p < pend && !isspace(*p))
+ while (p < pend && !ISSPACE(*p))
p++;
*p++ = '\0';
if (p < pend) {
@@ -559,13 +558,13 @@ load_file(fname, script)
argc = 2; argv[0] = 0;
while (*p == '-') {
- while (*s && !isspace(*s))
+ while (*s && !ISSPACE(*s))
s++;
*s = '\0';
argv[1] = p;
proc_options(&argc, &argvp);
p = ++s;
- while (*p && isspace(*p))
+ while (*p && ISSPACE(*p))
p++;
}
}
diff --git a/ruby.h b/ruby.h
index 3ad9071..e4bc0f7 100644
--- a/ruby.h
+++ b/ruby.h
@@ -31,6 +31,18 @@ extern "C" {
# include <strings.h>
#endif
+#include <stdio.h>
+
+/* need to include <ctype.h> to use these macros */
+#define ISSPACE(c) isspace((unsigned char)(c))
+#define ISUPPER(c) isupper((unsigned char)(c))
+#define ISLOWER(c) islower((unsigned char)(c))
+#define ISPRINT(c) isprint((unsigned char)(c))
+#define ISALNUM(c) isalnum((unsigned char)(c))
+#define ISALPHA(c) isalpha((unsigned char)(c))
+#define ISDIGIT(c) isdigit((unsigned char)(c))
+#define ISXDIGIT(c) isxdigit((unsigned char)(c))
+
#ifndef __STDC__
# define volatile
# ifdef __GNUC__
diff --git a/sig.h b/sig.h
index 24a5160..ea2f4d3 100644
--- a/sig.h
+++ b/sig.h
@@ -24,9 +24,9 @@ void trap_restore_mask _((void));
#ifdef THREAD
extern int thread_critical;
+void thread_schedule _((void));
#if defined(HAVE_SETITIMER) && !defined(__BOW__)
extern int thread_pending;
-void thread_schedule();
# define CHECK_INTS if (!prohibit_interrupt) {\
if (trap_pending) rb_trap_exec();\
if (thread_pending && !thread_critical) thread_schedule();\
@@ -35,7 +35,6 @@ void thread_schedule();
/* pseudo preemptive thread switching */
extern int thread_tick;
#define THREAD_TICK 500
-void thread_schedule();
# define CHECK_INTS if (!prohibit_interrupt) {\
if (trap_pending) rb_trap_exec();\
if (!thread_critical) {\
diff --git a/sprintf.c b/sprintf.c
index d8de7d5..27103f9 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -13,7 +13,7 @@
#include "ruby.h"
#include <ctype.h>
-static void fmt_setup();
+static void fmt_setup _((char*,char,int,int,int));
static char*
remove_sign_bits(str, base)
@@ -99,10 +99,7 @@ remove_sign_bits(str, base)
return str;
}
-double big2dbl();
-#ifndef atof
-double atof();
-#endif
+double big2dbl _((VALUE));
VALUE
f_sprintf(argc, argv)
@@ -165,7 +162,7 @@ f_sprintf(argc, argv)
retry:
switch (*p) {
default:
- if (isprint(*p))
+ if (ISPRINT(*p))
ArgError("malformed format string - %%%c", *p);
else
ArgError("malformed format string");
@@ -199,7 +196,7 @@ f_sprintf(argc, argv)
case '5': case '6': case '7': case '8': case '9':
flags |= FWIDTH;
width = 0;
- for (; p < end && isdigit(*p); p++) {
+ for (; p < end && ISDIGIT(*p); p++) {
width = 10 * width + (*p - '0');
}
if (p >= end) {
@@ -239,7 +236,7 @@ f_sprintf(argc, argv)
goto retry;
}
- for (; p < end && isdigit(*p); p++) {
+ for (; p < end && ISDIGIT(*p); p++) {
prec = 10 * prec + (*p - '0');
}
if (p >= end) {
diff --git a/string.c b/string.c
index 7c232e2..1fb6e4d 100644
--- a/string.c
+++ b/string.c
@@ -16,8 +16,8 @@
#define BEG(no) regs->beg[no]
#define END(no) regs->end[no]
-#include <stdio.h>
#include <ctype.h>
+
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -726,7 +726,7 @@ str_succ(orig)
sbeg = RSTRING(str)->ptr; s = sbeg + RSTRING(str)->len - 1;
while (sbeg <= s) {
- if (isalnum(*s) && (c = succ_char(s)) == 0) break;
+ if (ISALNUM(*s) && (c = succ_char(s)) == 0) break;
s--;
}
if (s < sbeg) {
@@ -1360,10 +1360,6 @@ str_to_i(str)
return str2inum(RSTRING(str)->ptr, 10);
}
-#ifndef atof
-double atof();
-#endif
-
static VALUE
str_to_f(str)
VALUE str;
@@ -1422,7 +1418,7 @@ str_inspect(str)
*b++ = '\\';
*b++ = '\\';
}
- else if (isprint(c)) {
+ else if (ISPRINT(c)) {
CHECK(1);
*b++ = c;
}
@@ -1494,7 +1490,7 @@ str_dump(str)
break;
default:
- if (isascii(c) && isprint(c)) {
+ if (ISPRINT(c)) {
len++;
}
else {
@@ -1605,7 +1601,7 @@ str_downcase_bang(str)
if (ismbchar(*s)) {
s++;
}
- else if (isupper(*s)) {
+ else if (ISUPPER(*s)) {
*s = tolower(*s);
modify = 1;
}
@@ -1635,7 +1631,7 @@ str_capitalize_bang(str)
str_modify(str);
s = RSTRING(str)->ptr; send = s + RSTRING(str)->len;
- if (islower(*s)) {
+ if (ISLOWER(*s)) {
*s = toupper(*s);
modify = 1;
}
@@ -1643,7 +1639,7 @@ str_capitalize_bang(str)
if (ismbchar(*s)) {
s++;
}
- else if (isupper(*s)) {
+ else if (ISUPPER(*s)) {
*s = tolower(*s);
modify = 1;
}
@@ -1675,11 +1671,11 @@ str_swapcase_bang(str)
if (ismbchar(*s)) {
s++;
}
- else if (isupper(*s)) {
+ else if (ISUPPER(*s)) {
*s = tolower(*s);
modify = 1;
}
- else if (islower(*s)) {
+ else if (ISLOWER(*s)) {
*s = toupper(*s);
modify = 1;
}
@@ -1738,7 +1734,7 @@ trnext(t)
}
}
-static VALUE str_delete_bang();
+static VALUE str_delete_bang _((VALUE,VALUE));
static VALUE
tr_trans(str, src, repl, sflag)
@@ -1910,7 +1906,7 @@ str_delete_bang(str1, str2)
static VALUE
str_delete(str1, str2)
- VALUE str1, *str2;
+ VALUE str1, str2;
{
VALUE val = str_delete_bang(str_dup(str1), str2);
@@ -2057,7 +2053,7 @@ str_split_method(argc, argv, str)
for (end = beg = 0; ptr<eptr; ptr++) {
if (skip) {
- if (isspace(*ptr)) {
+ if (ISSPACE(*ptr)) {
beg++;
}
else {
@@ -2066,7 +2062,7 @@ str_split_method(argc, argv, str)
}
}
else {
- if (isspace(*ptr)) {
+ if (ISSPACE(*ptr)) {
ary_push(result, str_substr(str, beg, end-beg));
skip = 1;
beg = end + 1;
@@ -2358,11 +2354,11 @@ str_strip_bang(str)
s = RSTRING(str)->ptr;
e = t = s + RSTRING(str)->len;
/* remove spaces at head */
- while (s < t && isspace(*s)) s++;
+ while (s < t && ISSPACE(*s)) s++;
/* remove trailing spaces */
t--;
- while (s <= t && isspace(*t)) t--;
+ while (s <= t && ISSPACE(*t)) t--;
t++;
RSTRING(str)->len = t-s;
diff --git a/struct.c b/struct.c
index 4785690..fd7a5ab 100644
--- a/struct.c
+++ b/struct.c
@@ -14,7 +14,6 @@
#include <stdio.h>
#endif
-ID rb_frame_last_func();
VALUE cStruct;
extern VALUE mEnumerable;
@@ -130,8 +129,6 @@ struct_set(obj, val)
/* not reached */
}
-VALUE struct_alloc();
-
static VALUE
make_struct(name, member, klass)
VALUE name, member, klass;
@@ -286,8 +283,6 @@ struct_each(s)
return Qnil;
}
-char *rb_class2name();
-
static VALUE
struct_to_s(s)
VALUE s;
diff --git a/util.c b/util.c
index f299c1c..09e4a01 100644
--- a/util.c
+++ b/util.c
@@ -48,7 +48,7 @@ rb_test_false_or_nil(v)
#include "util.h"
#ifndef HAVE_STRING_H
-char *strchr();
+char *strchr _((char*,char));
#endif
unsigned long
@@ -305,7 +305,6 @@ valid_filename(char *s)
#include <libc/stubs.h>
#include <stdio.h> /* For FILENAME_MAX */
#include <errno.h> /* For errno */
-#include <ctype.h> /* For tolower */
#include <fcntl.h> /* For LFN stuff */
#include <go32.h>
#include <dpmi.h> /* For dpmisim */
diff --git a/util.h b/util.h
index 78f8169..2aa9f96 100644
--- a/util.h
+++ b/util.h
@@ -12,7 +12,7 @@
#ifndef UTIL_H
#define UTIL_H
-unsigned long scan_hex();
-unsigned long scan_oct();
+unsigned long scan_oct _((char*,int,int*));
+unsigned long scan_hex _((char*,int,int*));
#endif /* UTIL_H */
diff --git a/variable.c b/variable.c
index 381cad4..845d55a 100644
--- a/variable.c
+++ b/variable.c
@@ -22,8 +22,6 @@ st_table *rb_class_tbl;
#define global_tbl rb_global_tbl
#define class_tbl rb_class_tbl
-int rb_const_defined();
-
st_table*
new_idhash()
{