mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* io.c (io_encname_bom_p): removed magic number.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f64949e276
commit
5a12fb5fb8
2 changed files with 8 additions and 2 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Mon Sep 7 17:13:53 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* io.c (io_encname_bom_p): removed magic number.
|
||||||
|
|
||||||
Mon Sep 7 12:26:04 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Mon Sep 7 12:26:04 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* lib/irb/inspector.rb (IRB::INSPECTORS.def_inspector): support
|
* lib/irb/inspector.rb (IRB::INSPECTORS.def_inspector): support
|
||||||
|
|
6
io.c
6
io.c
|
@ -3938,11 +3938,13 @@ rb_io_fmode_modestr(int fmode)
|
||||||
static int
|
static int
|
||||||
io_encname_bom_p(const char *name, long len)
|
io_encname_bom_p(const char *name, long len)
|
||||||
{
|
{
|
||||||
|
static const char bom_prefix[] = "bom|utf-";
|
||||||
|
enum {bom_prefix_len = (int)sizeof(bom_prefix) - 1};
|
||||||
if (!len) {
|
if (!len) {
|
||||||
const char *p = strchr(name, ':');
|
const char *p = strchr(name, ':');
|
||||||
len = p ? p - name : strlen(name);
|
len = p ? (long)(p - name) : (long)strlen(name);
|
||||||
}
|
}
|
||||||
return len > 8 && STRNCASECMP(name, "bom|utf-", 8) == 0;
|
return len > bom_prefix_len && STRNCASECMP(name, bom_prefix, bom_prefix_len) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Reference in a new issue