summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--eval.c12
-rw-r--r--file.c7
-rw-r--r--missing.h6
-rw-r--r--missing/strchr.c18
-rw-r--r--missing/strstr.c11
-rw-r--r--ruby.c6
7 files changed, 27 insertions, 40 deletions
diff --git a/ChangeLog b/ChangeLog
index 7303bb7c58..8a94312b33 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Thu Oct 20 11:18:11 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
+
+ * eval.c, file.c, ruby.c: removed strchr, strrchr, strstr definition
+ because they are defined in missing.h.
+
+ * missing.h, missing/strchr.c, missing/strstr.c: ANSI styled.
+
Thu Oct 20 09:36:06 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
* lib/mkmf.rb (create_makefile): Borland make seems not to allow
diff --git a/eval.c b/eval.c
index 7339690b73..4a5cfab1a5 100644
--- a/eval.c
+++ b/eval.c
@@ -65,10 +65,6 @@ void *alloca ();
#include <stdarg.h>
-#ifndef HAVE_STRING_H
-char *strrchr(const char*,const char);
-#endif
-
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -1029,8 +1025,8 @@ static void pop_thread_anchor(struct ruby_env *);
POP_TAG()
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);
@@ -6066,7 +6062,7 @@ rb_frame_this_func(void)
}
static NODE*
-compile(VALUE src, char *file, int line)
+compile(VALUE src, const char *file, int line)
{
NODE *node;
int critical;
@@ -6083,7 +6079,7 @@ compile(VALUE src, char *file, int line)
}
static VALUE
-eval(VALUE self, VALUE src, VALUE scope, char *file, int line)
+eval(VALUE self, VALUE src, VALUE scope, const char *file, int line)
{
struct BLOCK *data = NULL;
volatile VALUE result = Qnil;
diff --git a/file.c b/file.c
index f9e6f752f3..c1a69575f6 100644
--- a/file.c
+++ b/file.c
@@ -53,10 +53,6 @@ VALUE rb_time_new(time_t, time_t);
#include <pwd.h>
#endif
-#ifndef HAVE_STRING_H
-char *strrchr(const char*,const char);
-#endif
-
#include <sys/types.h>
#include <sys/stat.h>
@@ -3881,8 +3877,7 @@ path_check_0(VALUE path, int loadpath)
#endif
static int
-fpath_check(path)
- char *path;
+fpath_check(const char *path)
{
#ifndef DOSISH
return path_check_0(rb_str_new2(path), Qfalse);
diff --git a/missing.h b/missing.h
index f402b1f655..3703c00309 100644
--- a/missing.h
+++ b/missing.h
@@ -99,8 +99,8 @@ extern int strncasecmp(char *, char *, int);
#endif
#ifndef HAVE_STRCHR
-extern char *strchr(char *, int);
-extern char *strrchr(char *, int);
+extern char *strchr(const char *, int);
+extern char *strrchr(const char *, int);
#endif
#ifndef HAVE_STRERROR
@@ -112,7 +112,7 @@ extern size_t strftime(char *, size_t, const char *, const struct tm *);
#endif
#ifndef HAVE_STRSTR
-extern char *strstr(char *, char *);
+extern char *strstr(const char *, const char *);
#endif
/*
diff --git a/missing/strchr.c b/missing/strchr.c
index 886d70ede6..bebd7ba578 100644
--- a/missing/strchr.c
+++ b/missing/strchr.c
@@ -1,32 +1,28 @@
/* public domain rewrite of strchr(3) and strrchr(3) */
char *
-strchr(s, c)
- char *s;
- int c;
+strchr(const char *s, int c)
{
- if (c == 0) return s + strlen(s);
+ if (c == 0) return (char *)s + strlen(s);
while (*s) {
if (*s == c)
- return s;
+ return (char *)s;
s++;
}
return 0;
}
char *
-strrchr(s, c)
- char *s;
- int c;
+strrchr(const char *s, int c)
{
- char *save;
+ const char *save;
- if (c == 0) return s + strlen(s);
+ if (c == 0) return (char *)s + strlen(s);
save = 0;
while (*s) {
if (*s == c)
save = s;
s++;
}
- return save;
+ return (char *)save;
}
diff --git a/missing/strstr.c b/missing/strstr.c
index 1673518f06..2e9c282fb1 100644
--- a/missing/strstr.c
+++ b/missing/strstr.c
@@ -1,20 +1,19 @@
/* public domain rewrite of strstr(3) */
char *
-strstr(haystack, needle)
- char *haystack, *needle;
+strstr(const char *haystack, const char *needle)
{
- char *hend;
- char *a, *b;
+ const char *hend;
+ const char *a, *b;
- if (*needle == 0) return haystack;
+ if (*needle == 0) return (char *)haystack;
hend = haystack + strlen(haystack) - strlen(needle) + 1;
while (haystack < hend) {
if (*haystack == *needle) {
a = haystack;
b = needle;
for (;;) {
- if (*b == 0) return haystack;
+ if (*b == 0) return (char *)haystack;
if (*a++ != *b++) {
break;
}
diff --git a/ruby.c b/ruby.c
index 42f8cb3fc9..f3c7f88bd0 100644
--- a/ruby.c
+++ b/ruby.c
@@ -40,12 +40,6 @@
# define MAXPATHLEN 1024
#endif
-#ifndef HAVE_STRING_H
-char *strchr(const char*,const char);
-char *strrchr(const char*,const char);
-char *strstr(const char*,const char*);
-#endif
-
#include "util.h"
#ifndef HAVE_STDLIB_H