mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
BUFCHECK() doesn't update p/pend in loop.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
33c9c0005b
commit
b8dfb46df7
2 changed files with 7 additions and 7 deletions
|
@ -1,4 +1,4 @@
|
||||||
Sun Aug 24 00:44:03 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sun Aug 24 01:02:48 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* file.c (file_expand_path): performance improvement.
|
* file.c (file_expand_path): performance improvement.
|
||||||
[ruby-talk:79748]
|
[ruby-talk:79748]
|
||||||
|
|
10
file.c
10
file.c
|
@ -1589,7 +1589,7 @@ file_expand_path(fname, dname, result)
|
||||||
s++;
|
s++;
|
||||||
#endif
|
#endif
|
||||||
s = nextdirsep(b = s);
|
s = nextdirsep(b = s);
|
||||||
BUFCHECK(p + (s-b) >= pend);
|
BUFCHECK(bdiff + (s-b) >= buflen);
|
||||||
memcpy(p, b, s-b);
|
memcpy(p, b, s-b);
|
||||||
p += s-b;
|
p += s-b;
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
|
@ -1613,7 +1613,7 @@ file_expand_path(fname, dname, result)
|
||||||
if (isdirsep(s[2])) {
|
if (isdirsep(s[2])) {
|
||||||
/* specified drive letter, and full path */
|
/* specified drive letter, and full path */
|
||||||
/* skip drive letter */
|
/* skip drive letter */
|
||||||
BUFCHECK(p + 2 >= pend);
|
BUFCHECK(bdiff + 2 >= buflen);
|
||||||
memcpy(p, s, 2);
|
memcpy(p, s, 2);
|
||||||
p += 2;
|
p += 2;
|
||||||
s += 2;
|
s += 2;
|
||||||
|
@ -1667,7 +1667,7 @@ file_expand_path(fname, dname, result)
|
||||||
b = s;
|
b = s;
|
||||||
do s++; while (isdirsep(*s));
|
do s++; while (isdirsep(*s));
|
||||||
p = buf + (s - b);
|
p = buf + (s - b);
|
||||||
BUFCHECK(p >= pend);
|
BUFCHECK(bdiff >= buflen);
|
||||||
memset(buf, '/', p - buf);
|
memset(buf, '/', p - buf);
|
||||||
}
|
}
|
||||||
if (p > buf && p[-1] == '/')
|
if (p > buf && p[-1] == '/')
|
||||||
|
@ -1718,7 +1718,7 @@ file_expand_path(fname, dname, result)
|
||||||
#endif
|
#endif
|
||||||
if (s > b) {
|
if (s > b) {
|
||||||
long rootdiff = root - buf;
|
long rootdiff = root - buf;
|
||||||
BUFCHECK(p + (s-b+1) >= pend);
|
BUFCHECK(bdiff + (s-b+1) >= buflen);
|
||||||
root = buf + rootdiff;
|
root = buf + rootdiff;
|
||||||
memcpy(++p, b, s-b);
|
memcpy(++p, b, s-b);
|
||||||
p += s-b;
|
p += s-b;
|
||||||
|
@ -1733,7 +1733,7 @@ file_expand_path(fname, dname, result)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s > b) {
|
if (s > b) {
|
||||||
BUFCHECK(p + (s-b) >= pend);
|
BUFCHECK(bdiff + (s-b) >= buflen);
|
||||||
memcpy(++p, b, s-b);
|
memcpy(++p, b, s-b);
|
||||||
p += s-b;
|
p += s-b;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue