diff options
author | Björn Gustavsson <[email protected]> | 2011-05-06 11:58:03 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2011-05-06 12:05:05 +0200 |
commit | 4aeb38abc1d9162b98a3ba4346ebdabad8532da6 (patch) | |
tree | 57124e3da238abea46a2c6ff4b2a7a8526538bf9 /erts/emulator | |
parent | 963843aad736997a66db8f8fdec6b3099373b742 (diff) | |
download | otp-4aeb38abc1d9162b98a3ba4346ebdabad8532da6.tar.gz otp-4aeb38abc1d9162b98a3ba4346ebdabad8532da6.tar.bz2 otp-4aeb38abc1d9162b98a3ba4346ebdabad8532da6.zip |
io.c: Make io_list_vec_len() less general
io_list_vec_len() is slightly more general than it needs to be.
Specifically:
* The only caller always passes ERL_SMALL_IO_BIN_LIMIT as the
value for the bin_limit parameter, so the bin_limit parameter
can be eliminated.
* The only caller never passes any NULL pointers, so there is
no need test the pointers before writing through them.
Diffstat (limited to 'erts/emulator')
-rw-r--r-- | erts/emulator/beam/io.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/erts/emulator/beam/io.c b/erts/emulator/beam/io.c index f619c6f88b..3610a06c0c 100644 --- a/erts/emulator/beam/io.c +++ b/erts/emulator/beam/io.c @@ -82,6 +82,9 @@ static void driver_monitor_unlock_pdl(Port *p); #define DRV_MONITOR_UNLOCK_PDL(Port) /* nothing */ #endif +#define ERL_SMALL_IO_BIN_LIMIT (4*ERL_ONHEAP_BIN_LIMIT) +#define SMALL_WRITE_VEC 16 + static ERTS_INLINE ErlIOQueue* drvport2ioq(ErlDrvPort drvport) { @@ -960,7 +963,7 @@ do { \ b_size += _size; \ in_clist = 0; \ v_size++; \ - if (_size >= bin_limit) { \ + if (_size >= ERL_SMALL_IO_BIN_LIMIT) { \ p_in_clist = 0; \ p_v_size++; \ } else { \ @@ -997,7 +1000,6 @@ do { \ static int io_list_vec_len(Eterm obj, int* vsize, int* csize, - int bin_limit, /* small binaries limit */ int * pvsize, int * pcsize) { DECLARE_ESTACK(s); @@ -1062,14 +1064,10 @@ io_list_vec_len(Eterm obj, int* vsize, int* csize, } DESTROY_ESTACK(s); - if (vsize != NULL) - *vsize = v_size; - if (csize != NULL) - *csize = c_size; - if (pvsize != NULL) - *pvsize = p_v_size; - if (pcsize != NULL) - *pcsize = p_c_size; + *vsize = v_size; + *csize = c_size; + *pvsize = p_v_size; + *pcsize = p_c_size; return c_size + b_size; L_type_error: @@ -1077,10 +1075,6 @@ io_list_vec_len(Eterm obj, int* vsize, int* csize, return -1; } -#define ERL_SMALL_IO_BIN_LIMIT (4*ERL_ONHEAP_BIN_LIMIT) -#define SMALL_WRITE_VEC 16 - - /* write data to a port */ int erts_write_to_port(Eterm caller_id, Port *p, Eterm list) { @@ -1107,7 +1101,6 @@ int erts_write_to_port(Eterm caller_id, Port *p, Eterm list) ErlIOVec ev; if ((size = io_list_vec_len(list, &vsize, &csize, - ERL_SMALL_IO_BIN_LIMIT, &pvsize, &pcsize)) < 0) { goto bad_value; } |