shithub: mc

Download patch

ref: 96c8217e913d8d6de22bbb1aa3624c26e66838fc
parent: 1eca6494d70ec51a950891697093525be826cef5
author: Ori Bernstein <ori@eigenstate.org>
date: Fri Jun 12 08:34:00 EDT 2015

Move more code to f2fmt and friends.

--- a/libbio/bio.myr
+++ b/libbio/bio.myr
@@ -109,7 +109,7 @@
 	| Rd:	-> std.Ordonly
 	| Wr:	-> std.Owronly
 	| Rw:	-> std.Ordwr
-	| _:	std.fatal("bio: bad file mode")
+	| _:	std.f2fatal("bio: bad file mode")
 	;;
 	-> 0
 }
@@ -403,11 +403,14 @@
 we're stuck with a small static buffer.
 */
 const put = {f, fmt, args
-	var buf : byte[2048]
-	var sl
+	var sb, sl, ap, n
 
-	sl = std.bfmt(buf[:], fmt, std.vastart(&args))
-	-> write(f, sl)
+	ap = std.vastart(&args)
+	sb = std.mksb()
+	sl = std.f2fmt(fmt, &ap)
+	n = write(f, sl)
+	std.slfree(sl)
+	-> n
 }
 
 /*