summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--util.c36
-rw-r--r--util.h6
3 files changed, 25 insertions, 27 deletions
diff --git a/ChangeLog b/ChangeLog
index 1019710f9c..1c76e78a8d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Sat Oct 22 14:25:43 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
+
+ * util.[hc] (ruby_add_suffix): constified.
+
+ * util.[hc] (ruby_scan_{oct,hex}): fixed typo. (renamed from
+ scan_{oct,hex})
+
+ * util.c: almostly ANSI styled. (except for functions depending on
+ macro and K&R tecknique)
+
Sat Oct 22 13:26:57 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* object.c (sym_inspect), parse.y (parser_yylex, rb_symname_p): check
diff --git a/util.c b/util.c
index da21ee412e..5eaee4cb0b 100644
--- a/util.c
+++ b/util.c
@@ -21,15 +21,9 @@
#endif
#include "util.h"
-#ifndef HAVE_STRING_H
-char *strchr(char*,char);
-#endif
unsigned long
-scan_oct(start, len, retlen)
- const char *start;
- int len;
- int *retlen;
+ruby_scan_oct(const char *start, int len, int *retlen)
{
register const char *s = start;
register unsigned long retval = 0;
@@ -43,10 +37,7 @@ scan_oct(start, len, retlen)
}
unsigned long
-scan_hex(start, len, retlen)
- const char *start;
- int len;
- int *retlen;
+ruby_scan_hex(const char *start, int len, int *retlen)
{
static char hexdigit[] = "0123456789abcdef0123456789ABCDEF";
register const char *s = start;
@@ -145,19 +136,17 @@ scan_hex(start, len, retlen)
*/
-static int valid_filename(char *s);
+static int valid_filename(const char *s);
-static char suffix1[] = ".$$$";
-static char suffix2[] = ".~~~";
+static const char suffix1[] = ".$$$";
+static const char suffix2[] = ".~~~";
#define ext (&buf[1000])
#define strEQ(s1,s2) (strcmp(s1,s2) == 0)
void
-ruby_add_suffix(str, suffix)
- VALUE str;
- char *suffix;
+ruby_add_suffix(VALUE str, const char *suffix)
{
int baselen;
int extlen = strlen(suffix);
@@ -227,7 +216,7 @@ fallback:
#if defined(__CYGWIN32__) || defined(_WIN32)
static int
-valid_filename(char *s)
+valid_filename(const char *s)
{
int fd;
@@ -620,8 +609,7 @@ ruby_qsort(void* base, const int nel, const int size,
}
char *
-ruby_strdup(str)
- const char *str;
+ruby_strdup(const char *str)
{
char *tmp;
int len = strlen(str) + 1;
@@ -633,7 +621,7 @@ ruby_strdup(str)
}
char *
-ruby_getcwd()
+ruby_getcwd(void)
{
#ifdef HAVE_GETCWD
int size = 200;
@@ -715,8 +703,8 @@ static double powersOf10[] = { /* Table giving binary powers of 10. Entry */
*/
double
-ruby_strtod(string, endPtr)
- const char *string; /* A decimal ASCII floating-point number,
+ruby_strtod(
+ const char *string, /* A decimal ASCII floating-point number,
* optionally preceded by white space.
* Must have form "-I.FE-X", where I is the
* integer part of the mantissa, F is the
@@ -729,7 +717,7 @@ ruby_strtod(string, endPtr)
* The "E" may actually be an "e". E and X
* may both be omitted (but not just one).
*/
- char **endPtr; /* If non-NULL, store terminating character's
+ char **endPtr) /* If non-NULL, store terminating character's
* address here. */
{
int sign, expSign = FALSE;
diff --git a/util.h b/util.h
index 23316292bf..920549fbde 100644
--- a/util.h
+++ b/util.h
@@ -35,12 +35,12 @@
#endif
#define scan_oct ruby_scan_oct
-unsigned long scan_oct(const char*, int, int*);
+unsigned long ruby_scan_oct(const char*, int, int*);
#define scan_hex ruby_scan_hex
-unsigned long scan_hex(const char*, int, int*);
+unsigned long ruby_scan_hex(const char*, int, int*);
#if defined(MSDOS) || defined(__CYGWIN32__) || defined(_WIN32)
-void ruby_add_suffix(VALUE str, char *suffix);
+void ruby_add_suffix(VALUE str, const char *suffix);
#endif
void ruby_qsort(void*, const int, const int, int (*)(const void*,const void*,void*), void*);