diff options
author | Ori Bernstein <ori@eigenstate.org> | 2016-06-19 00:25:00 -0700 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2016-06-19 00:25:00 -0700 |
commit | 595f94567824d5c4d1e4ef75ed825eccc6b1783c (patch) | |
tree | 7a5bcb9b97b3d6a1b193cd2563d50b8e3cc83a44 /lib/bio | |
parent | c13709b6d407e69dcaf10134c01cabb67b5dee13 (diff) | |
download | mc-595f94567824d5c4d1e4ef75ed825eccc6b1783c.tar.gz |
Add putv to bio.
Diffstat (limited to 'lib/bio')
-rw-r--r-- | lib/bio/bio.myr | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/bio/bio.myr b/lib/bio/bio.myr index abfc2a5..a6dfd48 100644 --- a/lib/bio/bio.myr +++ b/lib/bio/bio.myr @@ -69,6 +69,7 @@ pkg bio = /* formatted i/o */ const put : (f : file#, fmt : byte[:], args : ... -> status(std.size)) + const putv : (f : file#, fmt : byte[:], ap : std.valist# -> status(std.size)) /* pkg funcs */ pkglocal const ensureread : (f : file#, n : std.size -> status(std.size)) @@ -529,6 +530,15 @@ const put = {f, fmt, args -> n } +const putv = {f, fmt, ap + var sl, n + + sl = std.fmtv(fmt, ap) + n = write(f, sl) + std.slfree(sl) + -> n +} + /* reads n bytes from the read buffer onto the heap-allocated slice provided. |