Skip to content

Commit e606b55

Browse files
committed
unecessary macros and K&R style coding
* strftime.c: remove unnecessary macros to check traditional C. ruby#46 by lateau (Daehyub Kim). * vsnprintf.c: remove K&R. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 151b54d commit e606b55

File tree

3 files changed

+15
-47
lines changed

3 files changed

+15
-47
lines changed

ChangeLog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
Thu Aug 16 09:46:07 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
2+
3+
* strftime.c: remove unnecessary macros to check traditional C.
4+
https://github.com/ruby/ruby/pull/46 by lateau (Daehyub Kim).
5+
6+
* vsnprintf.c: remove K&R.
7+
18
Wed Aug 15 20:47:49 2012 Benoit Daloze <eregontp@gmail.com>
29

310
* object.c (rb_obj_inspect): Kernel#inspect: do not call #to_s. A class

strftime.c

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,8 @@ extern char *strchr();
127127

128128
/* min --- return minimum of two numbers */
129129

130-
#ifndef __STDC__
131-
static inline int
132-
min(a, b)
133-
int a, b;
134-
#else
135130
static inline int
136131
min(int a, int b)
137-
#endif
138132
{
139133
return (a < b ? a : b);
140134
}
@@ -143,14 +137,8 @@ min(int a, int b)
143137

144138
/* max --- return maximum of two numbers */
145139

146-
#ifndef __STDC__
147-
static inline int
148-
max(a, b)
149-
int a, b;
150-
#else
151140
static inline int
152141
max(int a, int b)
153-
#endif
154142
{
155143
return (a > b ? a : b);
156144
}
@@ -852,14 +840,8 @@ rb_strftime_timespec(char *s, size_t maxsize, const char *format, rb_encoding *e
852840

853841
/* isleap --- is a year a leap year? */
854842

855-
#ifndef __STDC__
856-
static int
857-
isleap(year)
858-
long year;
859-
#else
860843
static int
861844
isleap(long year)
862-
#endif
863845
{
864846
return ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0);
865847
}
@@ -893,14 +875,8 @@ vtm2tm_noyear(const struct vtm *vtm, struct tm *result)
893875
#ifdef POSIX2_DATE
894876
/* iso8601wknum --- compute week number according to ISO 8601 */
895877

896-
#ifndef __STDC__
897-
static int
898-
iso8601wknum(timeptr)
899-
const struct tm *timeptr;
900-
#else
901878
static int
902879
iso8601wknum(const struct tm *timeptr)
903-
#endif
904880
{
905881
/*
906882
* From 1003.2:
@@ -1020,15 +996,8 @@ iso8601wknum_v(const struct vtm *vtm)
1020996

1021997
/* With thanks and tip of the hatlo to ado@elsie.nci.nih.gov */
1022998

1023-
#ifndef __STDC__
1024-
static int
1025-
weeknumber(timeptr, firstweekday)
1026-
const struct tm *timeptr;
1027-
int firstweekday;
1028-
#else
1029999
static int
10301000
weeknumber(const struct tm *timeptr, int firstweekday)
1031-
#endif
10321001
{
10331002
int wday = timeptr->tm_wday;
10341003
int ret;
@@ -1164,9 +1133,7 @@ static char *array[] =
11641133
/* main routine. */
11651134

11661135
int
1167-
main(argc, argv)
1168-
int argc;
1169-
char **argv;
1136+
main(int argc, char **argv)
11701137
{
11711138
long time();
11721139

vsnprintf.c

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,8 @@ struct __suio {
243243
* This routine is large and unsightly, but most of the ugliness due
244244
* to the three different kinds of output buffering is handled here.
245245
*/
246-
static int BSD__sfvwrite(fp, uio)
247-
register FILE *fp;
248-
register struct __suio *uio;
246+
static int
247+
BSD__sfvwrite(register FILE *fp, register struct __suio *uio)
249248
{
250249
register size_t len;
251250
register const char *p;
@@ -503,8 +502,8 @@ BSD__ultoa(register u_long val, char *endp, int base, int octzero, const char *x
503502
#define BUF (MAXEXP+MAXFRACT+1) /* + decimal point */
504503
#define DEFPREC 6
505504

506-
static char *cvt __P((double, int, int, char *, int *, int, int *, char *));
507-
static int exponent __P((char *, int, int));
505+
static char *cvt(double, int, int, char *, int *, int, int *, char *);
506+
static int exponent(char *, int, int);
508507

509508
#else /* no FLOATING_POINT */
510509

@@ -1203,14 +1202,11 @@ number: if ((dprec = prec) >= 0)
12031202

12041203
#ifdef FLOATING_POINT
12051204

1206-
extern char *BSD__dtoa __P((double, int, int, int *, int *, char **));
1205+
extern char *BSD__dtoa(double, int, int, int *, int *, char **);
12071206
extern char *BSD__hdtoa(double, const char *, int, int *, int *, char **);
12081207

12091208
static char *
1210-
cvt(value, ndigits, flags, sign, decpt, ch, length, buf)
1211-
double value;
1212-
int ndigits, flags, *decpt, ch, *length;
1213-
char *sign, *buf;
1209+
cvt(double value, int ndigits, int flags, char *sign, int *decpt, int ch, int *length, char *buf)
12141210
{
12151211
int mode, dsgn;
12161212
char *digits, *bp, *rve;
@@ -1256,9 +1252,7 @@ cvt(value, ndigits, flags, sign, decpt, ch, length, buf)
12561252
}
12571253

12581254
static int
1259-
exponent(p0, exp, fmtch)
1260-
char *p0;
1261-
int exp, fmtch;
1255+
exponent(char *p0, int exp, int fmtch)
12621256
{
12631257
register char *p, *t;
12641258
char expbuf[MAXEXP];

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy