summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-10-22 05:26:44 +0000
committerocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-10-22 05:26:44 +0000
commiteb82473a39e9d5b432f4fa4f36793a33a2fdfd05 (patch)
tree2d88c3c3f1a17758fd1f36d8ba0e67916afa3d4d /util.c
parent0cfe16bc21697d135c35fcb329c49cdd728da7bb (diff)
* 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) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'util.c')
-rw-r--r--util.c36
1 files changed, 12 insertions, 24 deletions
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;