aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2004-06-09 14:12:04 +0000
committerrsc <devnull@localhost>2004-06-09 14:12:04 +0000
commitd1b4cfde55d1ba163047cb49b1305452be6f66fc (patch)
tree26f81a14c4ec84d23721fcd36e8d8dd2bd36edab
parente290cfc1385e6ccb277d938981d87a81947166b3 (diff)
downloadplan9port-d1b4cfde55d1ba163047cb49b1305452be6f66fc.tar.gz
plan9port-d1b4cfde55d1ba163047cb49b1305452be6f66fc.tar.bz2
plan9port-d1b4cfde55d1ba163047cb49b1305452be6f66fc.zip
use plan9 malloc
-rw-r--r--src/lib9/fmt/fmtdef.h3
-rw-r--r--src/lib9/fmt/fmtstr.c7
-rw-r--r--src/lib9/fmt/runefmtstr.c7
-rw-r--r--src/lib9/fmt/vsmprint.c3
4 files changed, 8 insertions, 12 deletions
diff --git a/src/lib9/fmt/fmtdef.h b/src/lib9/fmt/fmtdef.h
index ca2010ab..89468767 100644
--- a/src/lib9/fmt/fmtdef.h
+++ b/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*);
diff --git a/src/lib9/fmt/fmtstr.c b/src/lib9/fmt/fmtstr.c
index 7af1fa24..0b227166 100644
--- a/src/lib9/fmt/fmtstr.c
+++ b/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
diff --git a/src/lib9/fmt/runefmtstr.c b/src/lib9/fmt/runefmtstr.c
index a2ec6cb4..9ec84cd0 100644
--- a/src/lib9/fmt/runefmtstr.c
+++ b/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
diff --git a/src/lib9/fmt/vsmprint.c b/src/lib9/fmt/vsmprint.c
index 38ace62d..34a1b36f 100644
--- a/src/lib9/fmt/vsmprint.c
+++ b/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);
}