diff options
author | Björn-Egil Dahlberg <[email protected]> | 2016-05-11 16:17:49 +0200 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2016-05-11 16:17:49 +0200 |
commit | 8d8d8c3817988a50ed1e058e73b247ce0a8c3616 (patch) | |
tree | 1cffa273ecf4c464c045b866319af690cf832412 /erts/emulator/beam/erl_nif.c | |
parent | e1ad5319f0b76460d9147ef04640c469f5a180d6 (diff) | |
download | otp-8d8d8c3817988a50ed1e058e73b247ce0a8c3616.tar.gz otp-8d8d8c3817988a50ed1e058e73b247ce0a8c3616.tar.bz2 otp-8d8d8c3817988a50ed1e058e73b247ce0a8c3616.zip |
erts: Add enif_snprintf
* Add the capability to format erlang terms to a char buffer in nifs.
* Bump NIF version to 2.11
Diffstat (limited to 'erts/emulator/beam/erl_nif.c')
-rw-r--r-- | erts/emulator/beam/erl_nif.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c index a695a028ba..fa20ce3c86 100644 --- a/erts/emulator/beam/erl_nif.c +++ b/erts/emulator/beam/erl_nif.c @@ -1603,6 +1603,16 @@ int enif_fprintf(void* filep, const char* format, ...) return ret; } +int enif_snprintf(char *buffer, size_t size, const char* format, ...) +{ + int ret; + va_list arglist; + va_start(arglist, format); + ret = erts_vsnprintf(buffer, size, format, arglist); + va_end(arglist); + return ret; +} + /*********************************************************** ** Memory managed (GC'ed) "resource" objects ** ***********************************************************/ |