[前][次][番号順一覧][スレッド一覧]

ruby-changes:24660

From: nobu <ko1@a...>
Date: Thu, 16 Aug 2012 09:46:25 +0900 (JST)
Subject: [ruby-changes:24660] nobu:r36710 (trunk): unecessary macros and K&R style coding

nobu	2012-08-16 09:46:12 +0900 (Thu, 16 Aug 2012)

  New Revision: 36710

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36710

  Log:
    unecessary macros and K&R style coding
    
    * strftime.c: remove unnecessary macros to check traditional C.
      https://github.com/ruby/ruby/pull/46 by lateau (Daehyub Kim).
    * vsnprintf.c: remove K&R.

  Modified files:
    trunk/ChangeLog
    trunk/strftime.c
    trunk/vsnprintf.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 36709)
+++ ChangeLog	(revision 36710)
@@ -1,3 +1,10 @@
+Thu Aug 16 09:46:07 2012  Nobuyoshi Nakada  <nobu@r...>
+
+	* strftime.c: remove unnecessary macros to check traditional C.
+	  https://github.com/ruby/ruby/pull/46 by lateau (Daehyub Kim).
+
+	* vsnprintf.c: remove K&R.
+
 Wed Aug 15 20:47:49 2012  Benoit Daloze  <eregontp@g...>
 
 	* object.c (rb_obj_inspect): Kernel#inspect: do not call #to_s. A class
Index: vsnprintf.c
===================================================================
--- vsnprintf.c	(revision 36709)
+++ vsnprintf.c	(revision 36710)
@@ -243,9 +243,8 @@
  * This routine is large and unsightly, but most of the ugliness due
  * to the three different kinds of output buffering is handled here.
  */
-static int BSD__sfvwrite(fp, uio)
-	register FILE *fp;
-	register struct __suio *uio;
+static int
+BSD__sfvwrite(register FILE *fp, register struct __suio *uio)
 {
 	register size_t len;
 	register const char *p;
@@ -503,8 +502,8 @@
 #define	BUF		(MAXEXP+MAXFRACT+1)	/* + decimal point */
 #define	DEFPREC		6
 
-static char *cvt __P((double, int, int, char *, int *, int, int *, char *));
-static int exponent __P((char *, int, int));
+static char *cvt(double, int, int, char *, int *, int, int *, char *);
+static int exponent(char *, int, int);
 
 #else /* no FLOATING_POINT */
 
@@ -1203,14 +1202,11 @@
 
 #ifdef FLOATING_POINT
 
-extern char *BSD__dtoa __P((double, int, int, int *, int *, char **));
+extern char *BSD__dtoa(double, int, int, int *, int *, char **);
 extern char *BSD__hdtoa(double, const char *, int, int *, int *, char **);
 
 static char *
-cvt(value, ndigits, flags, sign, decpt, ch, length, buf)
-	double value;
-	int ndigits, flags, *decpt, ch, *length;
-	char *sign, *buf;
+cvt(double value, int ndigits, int flags, char *sign, int *decpt, int ch, int *length, char *buf)
 {
 	int mode, dsgn;
 	char *digits, *bp, *rve;
@@ -1256,9 +1252,7 @@
 }
 
 static int
-exponent(p0, exp, fmtch)
-	char *p0;
-	int exp, fmtch;
+exponent(char *p0, int exp, int fmtch)
 {
 	register char *p, *t;
 	char expbuf[MAXEXP];
Index: strftime.c
===================================================================
--- strftime.c	(revision 36709)
+++ strftime.c	(revision 36710)
@@ -127,14 +127,8 @@
 
 /* min --- return minimum of two numbers */
 
-#ifndef __STDC__
 static inline int
-min(a, b)
-int a, b;
-#else
-static inline int
 min(int a, int b)
-#endif
 {
 	return (a < b ? a : b);
 }
@@ -143,14 +137,8 @@
 
 /* max --- return maximum of two numbers */
 
-#ifndef __STDC__
 static inline int
-max(a, b)
-int a, b;
-#else
-static inline int
 max(int a, int b)
-#endif
 {
 	return (a > b ? a : b);
 }
@@ -852,14 +840,8 @@
 
 /* isleap --- is a year a leap year? */
 
-#ifndef __STDC__
 static int
-isleap(year)
-long year;
-#else
-static int
 isleap(long year)
-#endif
 {
 	return ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0);
 }
@@ -893,14 +875,8 @@
 #ifdef POSIX2_DATE
 /* iso8601wknum --- compute week number according to ISO 8601 */
 
-#ifndef __STDC__
 static int
-iso8601wknum(timeptr)
-const struct tm *timeptr;
-#else
-static int
 iso8601wknum(const struct tm *timeptr)
-#endif
 {
 	/*
 	 * From 1003.2:
@@ -1020,15 +996,8 @@
 
 /* With thanks and tip of the hatlo to ado@e... */
 
-#ifndef __STDC__
 static int
-weeknumber(timeptr, firstweekday)
-const struct tm *timeptr;
-int firstweekday;
-#else
-static int
 weeknumber(const struct tm *timeptr, int firstweekday)
-#endif
 {
 	int wday = timeptr->tm_wday;
 	int ret;
@@ -1164,9 +1133,7 @@
 /* main routine. */
 
 int
-main(argc, argv)
-int argc;
-char **argv;
+main(int argc, char **argv)
 {
 	long time();
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]