aboutsummaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-10-01 08:52:43 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-10-01 08:52:43 +0000
commit0ba9ccd77e8ca38c2abc659a14120eb35e9d7075 (patch)
treed088bc5a9770ce8a49b6ac8350798050dd8c510a /ext
parent20b54de26cc51bcc610a64075b7c529d306db3e7 (diff)
downloadruby-0ba9ccd77e8ca38c2abc659a14120eb35e9d7075.tar.gz
zonetab.h: use strncmp
* ext/date/zonetab.h (zonetab): use strncmp. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56313 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/date/date_parse.c3
-rw-r--r--ext/date/prereq.mk2
-rw-r--r--ext/date/zonetab.h4
3 files changed, 3 insertions, 6 deletions
diff --git a/ext/date/date_parse.c b/ext/date/date_parse.c
index 7a5ed723b4..08deaa049e 100644
--- a/ext/date/date_parse.c
+++ b/ext/date/date_parse.c
@@ -386,16 +386,13 @@ date_zone_to_diff(VALUE str)
if (l >= (int)sizeof(STD) - 1 && strcmp(d - (sizeof(STD) - 1), STD) == 0) {
l -= sizeof(STD) - 1;
- s[l] = '\0';
}
else if (l >= (int)sizeof(DST1) - 1 && strcmp(d - (sizeof(DST1) - 1), DST1) == 0) {
l -= sizeof(DST1) - 1;
- s[l] = '\0';
dst = 1;
}
else if (l >= (int)sizeof(DST2) - 1 && strcmp(d - (sizeof(DST2) - 1), DST2) == 0) {
l -= sizeof(DST2) - 1;
- s[l] = '\0';
dst = 1;
}
{
diff --git a/ext/date/prereq.mk b/ext/date/prereq.mk
index e9ee35adc6..a0a5a2bff3 100644
--- a/ext/date/prereq.mk
+++ b/ext/date/prereq.mk
@@ -1,7 +1,7 @@
.SUFFIXES: .list
.list.h:
- gperf -E -C -P -p -j1 -i 1 -g -o -t -N $(*F) $< \
+ gperf -E -C -c -P -p -j1 -i 1 -g -o -t -N $(*F) $< \
| sed 's/(int)(long)&((\(struct stringpool_t\) *\*)0)->\(stringpool_[a-z0-9]*\)/offsetof(\1, \2)/g' \
> $(@F)
diff --git a/ext/date/zonetab.h b/ext/date/zonetab.h
index 1497eb5f65..fa86e7991a 100644
--- a/ext/date/zonetab.h
+++ b/ext/date/zonetab.h
@@ -1,5 +1,5 @@
/* C code produced by gperf version 3.0.4 */
-/* Command-line: gperf -E -C -P -p -j1 -i 1 -g -o -t -N zonetab zonetab.list */
+/* Command-line: gperf -E -C -c -P -p -j1 -i 1 -g -o -t -N zonetab zonetab.list */
/* Computed positions: -k'1-4,$' */
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
@@ -891,7 +891,7 @@ zonetab (str, len)
{
register const char *s = o + stringpool;
- if (*str == *s && !strcmp (str + 1, s + 1))
+ if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
return &wordlist[key];
}
}