plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

commit d1b4cfde55d1ba163047cb49b1305452be6f66fc
parent e290cfc1385e6ccb277d938981d87a81947166b3
Author: rsc <devnull@localhost>
Date:   Wed,  9 Jun 2004 14:12:04 +0000

use plan9 malloc

Diffstat:
Msrc/lib9/fmt/fmtdef.h | 3+++
Msrc/lib9/fmt/fmtstr.c | 7++-----
Msrc/lib9/fmt/runefmtstr.c | 7++-----
Msrc/lib9/fmt/vsmprint.c | 3+--
4 files changed, 8 insertions(+), 12 deletions(-)

diff --git 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 @@ -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 @@ -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 @@ -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); }