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

ruby-changes:19285

From: tadf <ko1@a...>
Date: Sun, 24 Apr 2011 00:35:49 +0900 (JST)
Subject: [ruby-changes:19285] Ruby:r31324 (trunk): * ext/date/date_parse.c: removed some unused macros. use strchr()

tadf	2011-04-24 00:35:42 +0900 (Sun, 24 Apr 2011)

  New Revision: 31324

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

  Log:
    * ext/date/date_parse.c: removed some unused macros.  use strchr()
      instead of index().

  Modified files:
    trunk/ChangeLog
    trunk/ext/date/date_parse.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 31323)
+++ ChangeLog	(revision 31324)
@@ -1,3 +1,8 @@
+Sun Apr 24 00:34:23 2011  Tadayoshi Funaba  <tadf@d...>
+
+	* ext/date/date_parse.c: removed some unused macros.  use strchr()
+	  instead of index().
+
 Sat Apr 23 21:29:42 2011  Tadayoshi Funaba  <tadf@d...>
 
 	* ext/date/date_core.c: replacement of implementation of
Index: ext/date/date_parse.c
===================================================================
--- ext/date/date_parse.c	(revision 31323)
+++ ext/date/date_parse.c	(revision 31324)
@@ -296,8 +296,7 @@
 static int
 parse_day(VALUE str, VALUE hash)
 {
-    static const char pat_source[] =
-	"\\b(" ABBR_DAYS ")[^-\\d\\s]*";
+    static const char pat_source[] = "\\b(" ABBR_DAYS ")[^-\\d\\s]*";
     static VALUE pat = Qnil;
 
     REGCOMP_I(pat);
@@ -555,8 +554,7 @@
 static int
 parse_iso22(VALUE str, VALUE hash)
 {
-    static const char pat_source[] =
-	"-w-(\\d)\\b";
+    static const char pat_source[] = "-w-(\\d)\\b";
     static VALUE pat = Qnil;
 
     REGCOMP_I(pat);
@@ -581,8 +579,7 @@
 static int
 parse_iso23(VALUE str, VALUE hash)
 {
-    static const char pat_source[] =
-	"--(\\d{2})?-(\\d{2})\\b";
+    static const char pat_source[] = "--(\\d{2})?-(\\d{2})\\b";
     static VALUE pat = Qnil;
 
     REGCOMP_0(pat);
@@ -607,8 +604,7 @@
 static int
 parse_iso24(VALUE str, VALUE hash)
 {
-    static const char pat_source[] =
-	"--(\\d{2})(\\d{2})?\\b";
+    static const char pat_source[] = "--(\\d{2})(\\d{2})?\\b";
     static VALUE pat = Qnil;
 
     REGCOMP_0(pat);
@@ -632,11 +628,9 @@
 static int
 parse_iso25(VALUE str, VALUE hash)
 {
-    static const char pat0_source[] =
-	"[,.](\\d{2}|\\d{4})-\\d{3}\\b";
+    static const char pat0_source[] = "[,.](\\d{2}|\\d{4})-\\d{3}\\b";
     static VALUE pat0 = Qnil;
-    static const char pat_source[] =
-	"\\b(\\d{2}|\\d{4})-(\\d{3})\\b";
+    static const char pat_source[] = "\\b(\\d{2}|\\d{4})-(\\d{3})\\b";
     static VALUE pat = Qnil;
 
     REGCOMP_0(pat0);
@@ -660,11 +654,9 @@
 static int
 parse_iso26(VALUE str, VALUE hash)
 {
-    static const char pat0_source[] =
-	"\\d-\\d{3}\\b";
+    static const char pat0_source[] = "\\d-\\d{3}\\b";
     static VALUE pat0 = Qnil;
-    static const char pat_source[] =
-	"\\b-(\\d{3})\\b";
+    static const char pat_source[] = "\\b-(\\d{3})\\b";
     static VALUE pat = Qnil;
 
     REGCOMP_0(pat0);
@@ -1102,7 +1094,7 @@
 	    buf[l5 - 1] = '\0';
 
 	    s1 = buf + 1;
-	    s2 = index(buf, ':');
+	    s2 = strchr(buf, ':');
 	    if (s2) {
 		*s2 = '\0';
 		s2++;
@@ -1233,8 +1225,6 @@
     return flags;
 }
 
-#define HAVE_ALPHA_P() (check_class(str) & HAVE_ALPHA)
-#define HAVE_DIGIT_P() (check_class(str) & HAVE_DIGIT)
 #define HAVE_ELEM_P(x) ((check_class(str) & (x)) == (x))
 
 VALUE

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

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