tuse plan9 malloc - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit d1b4cfde55d1ba163047cb49b1305452be6f66fc
 (DIR) parent e290cfc1385e6ccb277d938981d87a81947166b3
 (HTM) Author: rsc <devnull@localhost>
       Date:   Wed,  9 Jun 2004 14:12:04 +0000
       
       use plan9 malloc
       
       Diffstat:
         M src/lib9/fmt/fmtdef.h               |       3 +++
         M src/lib9/fmt/fmtstr.c               |       7 ++-----
         M src/lib9/fmt/runefmtstr.c           |       7 ++-----
         M src/lib9/fmt/vsmprint.c             |       3 +--
       
       4 files changed, 8 insertions(+), 12 deletions(-)
       ---
 (DIR) diff --git a/src/lib9/fmt/fmtdef.h b/src/lib9/fmt/fmtdef.h
       t@@ -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;
       t@@ -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*);
 (DIR) diff --git a/src/lib9/fmt/fmtstr.c b/src/lib9/fmt/fmtstr.c
       t@@ -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
 (DIR) diff --git a/src/lib9/fmt/runefmtstr.c b/src/lib9/fmt/runefmtstr.c
       t@@ -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
 (DIR) diff --git a/src/lib9/fmt/vsmprint.c b/src/lib9/fmt/vsmprint.c
       t@@ -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);
        }