mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Minor performance optimization in SpawnerInputStream
This commit is contained in:
parent
5e58b2deb1
commit
2b5ba96a39
1 changed files with 4 additions and 2 deletions
|
@ -61,13 +61,15 @@ class SpawnerInputStream extends InputStream {
|
|||
} else if (len == 0) {
|
||||
return 0;
|
||||
}
|
||||
byte[] tmpBuf = new byte[len];
|
||||
byte[] tmpBuf = off > 0 ? new byte[len - off] : buf;
|
||||
|
||||
len = read0(fd, tmpBuf, len);
|
||||
if (len <= 0)
|
||||
return -1;
|
||||
|
||||
System.arraycopy(tmpBuf, 0, buf, off, len);
|
||||
if (tmpBuf != buf) {
|
||||
System.arraycopy(tmpBuf, 0, buf, off, len);
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue