Commit Diff


commit - e290cfc1385e6ccb277d938981d87a81947166b3
commit + d1b4cfde55d1ba163047cb49b1305452be6f66fc
blob - ca2010ab71954c7588be5cdb1061a6b1f326cac7
blob + 894687677446435d38a1814580ab95affdf92bd6
--- src/lib9/fmt/fmtdef.h
+++ src/lib9/fmt/fmtdef.h
@@ -25,7 +25,9 @@
 #define vlong _fmtvlong
 #define uvlong _fmtuvlong
 
+#ifndef USED
 #define USED(x) if(x);else
+#endif
 
 typedef unsigned char		uchar;
 typedef unsigned short		ushort;
@@ -37,6 +39,7 @@ typedef unsigned long long	uvlong;
 typedef long long		vlong;
 #endif
 
+#undef nil
 #define nil		0	/* cannot be ((void*)0) because used for function pointers */
 
 typedef int (*Fmts)(Fmt*);
blob - 7af1fa241c42c1f029ba1775053abc205e699630
blob + 0b227166d81548e2b589783721cc4879d94dee1b
--- src/lib9/fmt/fmtstr.c
+++ src/lib9/fmt/fmtstr.c
@@ -11,11 +11,8 @@
  * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
  * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
  */
-#include <stdarg.h>
-#include <string.h>
-#include <stdlib.h>
-#include "utf.h"
-#include "fmt.h"
+#include <u.h>
+#include <libc.h>
 #include "fmtdef.h"
 
 static int
blob - a2ec6cb484c814c886b50ef37c1ab32db312458e
blob + 9ec84cd0981ca290c9be6c91557511653d8729ea
--- src/lib9/fmt/runefmtstr.c
+++ src/lib9/fmt/runefmtstr.c
@@ -11,11 +11,8 @@
  * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
  * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
  */
-#include <stdarg.h>
-#include <string.h>
-#include <stdlib.h>
-#include "utf.h"
-#include "fmt.h"
+#include <u.h>
+#include <libc.h>
 #include "fmtdef.h"
 
 static int
blob - 38ace62d72cab15ec012342a5ef35214c6833a91
blob + 34a1b36f7ecf535d2b072f098ce91cddf85b9d0f
--- src/lib9/fmt/vsmprint.c
+++ src/lib9/fmt/vsmprint.c
@@ -31,6 +31,5 @@ vsmprint(char *fmt, va_list args)
 	n = dofmt(&f, fmt);
 	if(n < 0)
 		return nil;
-	*(char*)f.to = '\0';
-	return (char*)f.start;
+	return fmtstrflush(&f);
 }