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.
|
||||
[ruby-talk:79748]
|
||||
|
@ -518,7 +518,7 @@ add-log-time-format: (lambda ()
|
|||
(diff (+ (cadr time) 32400))
|
||||
(lo (% diff 65536))
|
||||
(hi (+ (car time) (/ diff 65536))))
|
||||
(format-time-string "%a %b %e %H:%M:%S %Y" (list hi lo) t)))
|
||||
(format-time-string "%a %b %e %H:%M:%S %Y" (list hi lo) t)))
|
||||
indent-tabs-mode: t
|
||||
tab-width: 8
|
||||
end:
|
||||
|
|
10
file.c
10
file.c
|
@ -1589,7 +1589,7 @@ file_expand_path(fname, dname, result)
|
|||
s++;
|
||||
#endif
|
||||
s = nextdirsep(b = s);
|
||||
BUFCHECK(p + (s-b) >= pend);
|
||||
BUFCHECK(bdiff + (s-b) >= buflen);
|
||||
memcpy(p, b, s-b);
|
||||
p += s-b;
|
||||
*p = '\0';
|
||||
|
@ -1613,7 +1613,7 @@ file_expand_path(fname, dname, result)
|
|||
if (isdirsep(s[2])) {
|
||||
/* specified drive letter, and full path */
|
||||
/* skip drive letter */
|
||||
BUFCHECK(p + 2 >= pend);
|
||||
BUFCHECK(bdiff + 2 >= buflen);
|
||||
memcpy(p, s, 2);
|
||||
p += 2;
|
||||
s += 2;
|
||||
|
@ -1667,7 +1667,7 @@ file_expand_path(fname, dname, result)
|
|||
b = s;
|
||||
do s++; while (isdirsep(*s));
|
||||
p = buf + (s - b);
|
||||
BUFCHECK(p >= pend);
|
||||
BUFCHECK(bdiff >= buflen);
|
||||
memset(buf, '/', p - buf);
|
||||
}
|
||||
if (p > buf && p[-1] == '/')
|
||||
|
@ -1718,7 +1718,7 @@ file_expand_path(fname, dname, result)
|
|||
#endif
|
||||
if (s > b) {
|
||||
long rootdiff = root - buf;
|
||||
BUFCHECK(p + (s-b+1) >= pend);
|
||||
BUFCHECK(bdiff + (s-b+1) >= buflen);
|
||||
root = buf + rootdiff;
|
||||
memcpy(++p, b, s-b);
|
||||
p += s-b;
|
||||
|
@ -1733,7 +1733,7 @@ file_expand_path(fname, dname, result)
|
|||
}
|
||||
|
||||
if (s > b) {
|
||||
BUFCHECK(p + (s-b) >= pend);
|
||||
BUFCHECK(bdiff + (s-b) >= buflen);
|
||||
memcpy(++p, b, s-b);
|
||||
p += s-b;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue