diff options
author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-04-23 15:35:42 +0000 |
---|---|---|
committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-04-23 15:35:42 +0000 |
commit | 05b3bd27d875c0bec404c7502603042573fb6c41 (patch) | |
tree | 69ef8ab5b4421766e1c7407ea50ce1f17aac2824 | |
parent | 37cfdf9f0b219ca879e17ceb19adba5c494642c7 (diff) | |
download | ruby-05b3bd27d875c0bec404c7502603042573fb6c41.tar.gz |
* ext/date/date_parse.c: removed some unused macros. use strchr()
instead of index().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | ext/date/date_parse.c | 28 |
2 files changed, 14 insertions, 19 deletions
@@ -1,3 +1,8 @@ +Sun Apr 24 00:34:23 2011 Tadayoshi Funaba <tadf@dotrb.org> + + * ext/date/date_parse.c: removed some unused macros. use strchr() + instead of index(). + Sat Apr 23 21:29:42 2011 Tadayoshi Funaba <tadf@dotrb.org> * ext/date/date_core.c: replacement of implementation of diff --git a/ext/date/date_parse.c b/ext/date/date_parse.c index 71dca78f7e..fd1dd654d0 100644 --- a/ext/date/date_parse.c +++ b/ext/date/date_parse.c @@ -296,8 +296,7 @@ parse_day_cb(VALUE m, VALUE hash) 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 @@ parse_iso22_cb(VALUE m, VALUE hash) 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 @@ parse_iso23_cb(VALUE m, VALUE hash) 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 @@ parse_iso24_cb(VALUE m, VALUE hash) 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 @@ parse_iso25_cb(VALUE m, VALUE hash) 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 @@ parse_iso26_cb(VALUE m, VALUE hash) 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 @@ parse_ddd_cb(VALUE m, VALUE hash) buf[l5 - 1] = '\0'; s1 = buf + 1; - s2 = index(buf, ':'); + s2 = strchr(buf, ':'); if (s2) { *s2 = '\0'; s2++; @@ -1233,8 +1225,6 @@ check_class(VALUE s) 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 |