diff options
author | Patrik Nyblom <[email protected]> | 2013-08-06 15:07:47 +0200 |
---|---|---|
committer | Patrik Nyblom <[email protected]> | 2013-08-09 12:10:53 +0200 |
commit | 925d69c56d376d1e2371cd2236c981bc97ccb706 (patch) | |
tree | 08d7bab53db5b32818c86bb231d56fda8ef051d2 | |
parent | 3e760de63ba212dd6e1e1de6d797202c60fcb26a (diff) | |
download | otp-925d69c56d376d1e2371cd2236c981bc97ccb706.tar.gz otp-925d69c56d376d1e2371cd2236c981bc97ccb706.tar.bz2 otp-925d69c56d376d1e2371cd2236c981bc97ccb706.zip |
Clarify relation between erts_iolist_{size|to_buf}
Just some clarifying comments to future progremmers to keep the relation
between error returns from the two functions.
-rw-r--r-- | erts/emulator/beam/utils.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/erts/emulator/beam/utils.c b/erts/emulator/beam/utils.c index 84deaecb87..c8695e61d5 100644 --- a/erts/emulator/beam/utils.c +++ b/erts/emulator/beam/utils.c @@ -3021,6 +3021,14 @@ buf_to_intlist(Eterm** hpp, char *buf, size_t len, Eterm tail) ** Return remaining bytes in buffer on success ** ERTS_IOLIST_TO_BUF_OVERFLOW on overflow ** ERTS_IOLIST_TO_BUF_TYPE_ERROR on type error (including that result would not be a whole number of bytes) +** +** Note! +** Do not detect indata errors in this fiunction that are not detected by erts_iolist_size! +** +** A caller should be able to rely on a successful return from erts_iolist_to_buf +** if erts_iolist_size is previously successfully called and erts_iolist_to_buf +** is called with a buffer at least as large as the value given by erts_iolist_size. +** */ ErlDrvSizeT erts_iolist_to_buf(Eterm obj, char* buf, ErlDrvSizeT alloced_len) @@ -3127,6 +3135,11 @@ ErlDrvSizeT erts_iolist_to_buf(Eterm obj, char* buf, ErlDrvSizeT alloced_len) /* * Return 0 if successful, and non-zero if unsuccessful. + * + * It is vital that if erts_iolist_to_buf would return an error for + * any type of term data, this function should do so as well. + * Any input term error detected in erts_iolist_to_buf should also + * be detected in this function! */ int erts_iolist_size(Eterm obj, ErlDrvSizeT* sizep) { |