Skip to content

Commit

Permalink
ext/date/date_strptime.c: moved detector of leftover.
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
tadf committed Jan 18, 2012
1 parent 6bada9c commit 1d794b9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Thu Jan 19 07:53:09 2012 Tadayoshi Funaba <[email protected]>

* ext/date/date_strptime.c: moved detector of leftover.

Thu Jan 19 07:10:47 2012 Tadayoshi Funaba <[email protected]>

* ext/date/date_parse.c: [ruby-core:42173].
Expand Down
21 changes: 10 additions & 11 deletions ext/date/date_strptime.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
date_strptime.c: Coded by Tadayoshi Funaba 2011
date_strptime.c: Coded by Tadayoshi Funaba 2011,2012
*/

#include "ruby.h"
Expand Down Expand Up @@ -641,25 +641,24 @@ date__strptime_internal(const char *str, size_t slen,
}
}

{
VALUE s;

if (slen > si) {
s = rb_usascii_str_new(&str[si], slen - si);
set_hash("leftover", s);
}
}

return si;
}

VALUE
date__strptime(const char *str, size_t slen,
const char *fmt, size_t flen, VALUE hash)
{
size_t si;
VALUE cent, merid;

date__strptime_internal(str, slen, fmt, flen, hash);
si = date__strptime_internal(str, slen, fmt, flen, hash);

if (slen > si) {
VALUE s;

s = rb_usascii_str_new(&str[si], slen - si);
set_hash("leftover", s);
}

if (fail_p())
return Qnil;
Expand Down

0 comments on commit 1d794b9

Please sign in to comment.