aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/drivers/common/efile_drv.c
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2013-02-15 16:37:52 +0100
committerLukas Larsson <[email protected]>2013-02-15 16:52:33 +0100
commit447bb87e842b235705e8b92db2918df8eb50ac09 (patch)
tree6885e7606f0743922c0337c1f136fc0b7308ac6f /erts/emulator/drivers/common/efile_drv.c
parentf7095c4c3ac256f2d587475d11a1cd09f9454a76 (diff)
downloadotp-447bb87e842b235705e8b92db2918df8eb50ac09.tar.gz
otp-447bb87e842b235705e8b92db2918df8eb50ac09.tar.bz2
otp-447bb87e842b235705e8b92db2918df8eb50ac09.zip
invoke_read_line now remembers read_ahead settings
Diffstat (limited to 'erts/emulator/drivers/common/efile_drv.c')
-rw-r--r--erts/emulator/drivers/common/efile_drv.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/erts/emulator/drivers/common/efile_drv.c b/erts/emulator/drivers/common/efile_drv.c
index 2279fec72a..22328fcd11 100644
--- a/erts/emulator/drivers/common/efile_drv.c
+++ b/erts/emulator/drivers/common/efile_drv.c
@@ -1160,7 +1160,14 @@ static void invoke_read_line(void *data)
/* Need more place */
ErlDrvSizeT need = (d->c.read_line.read_size >= DEFAULT_LINEBUF_SIZE) ?
d->c.read_line.read_size + DEFAULT_LINEBUF_SIZE : DEFAULT_LINEBUF_SIZE;
- ErlDrvBinary *newbin = driver_alloc_binary(need);
+ ErlDrvBinary *newbin;
+#if !ALWAYS_READ_LINE_AHEAD
+ /* Use read_ahead size if need does not exceed it */
+ if (need < (d->c.read_line.binp)->orig_size &&
+ d->c.read_line.read_ahead)
+ need = (d->c.read_line.binp)->orig_size;
+#endif
+ newbin = driver_alloc_binary(need);
if (newbin == NULL) {
d->result_ok = 0;
d->errInfo.posix_errno = ENOMEM;