aboutsummaryrefslogtreecommitdiffstats
path: root/ext/date/date_strptime.c
diff options
context:
space:
mode:
authortadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-08 09:41:38 +0000
committertadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-08 09:41:38 +0000
commit1348dd26b003665a8dc219ea8f5799834b40c941 (patch)
tree27179cfd769a582eea1ab735f9ed5d905932fbad /ext/date/date_strptime.c
parent1816a4a6a994f6437b6b741fa3a84bfb4c827c04 (diff)
downloadruby-1348dd26b003665a8dc219ea8f5799834b40c941.tar.gz
* ext/date/date_{parse,strptime}.c: introduced some macros.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/date/date_strptime.c')
-rw-r--r--ext/date/date_strptime.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/date/date_strptime.c b/ext/date/date_strptime.c
index fdc75660ab..897f5f8807 100644
--- a/ext/date/date_strptime.c
+++ b/ext/date/date_strptime.c
@@ -52,6 +52,8 @@ static const char *extz_pats[] = {
#define f_aref(o,i) rb_funcall(o, rb_intern("[]"), 1, i)
#define f_end(o,i) rb_funcall(o, rb_intern("end"), 1, i)
+#define issign(c) ((c) == '-' || (c) == '+')
+
static int
num_pattern_p(const char *s)
{
@@ -344,7 +346,7 @@ date__strptime_internal(const char *str, size_t slen,
int sign = 1;
size_t osi;
- if (str[si] == '-' || str[si] == '+') {
+ if (issign(str[si])) {
if (str[si] == '-')
sign = -1;
si++;
@@ -526,7 +528,7 @@ date__strptime_internal(const char *str, size_t slen,
VALUE n;
int sign = 1;
- if (str[si] == '-' || str[si] == '+') {
+ if (issign(str[si])) {
if (str[si] == '-')
sign = -1;
si++;