shithub: drawterm

Download patch

ref: f60d3735c65b04554d206ced6d45370cc1d5633d
parent: f18ed453ebe4e6e03a96804fd5a596d067fe0d04
author: Russ Cox <[email protected]>
date: Tue Jan 17 08:22:03 EST 2006

better includes?

--- a/libc/charstod.c
+++ b/libc/charstod.c
@@ -11,10 +11,8 @@
  * ANY 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 "plan9.h"
-#include "fmt.h"
+#include <u.h>
+#include <libc.h>
 #include "fmtdef.h"
 
 /*
--- a/libc/dofmt.c
+++ b/libc/dofmt.c
@@ -11,10 +11,8 @@
  * ANY 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 "plan9.h"
-#include "fmt.h"
+#include <u.h>
+#include <libc.h>
 #include "fmtdef.h"
 
 /* format the output into f->to and return the number of characters fmted  */
--- a/libc/dorfmt.c
+++ b/libc/dorfmt.c
@@ -11,10 +11,8 @@
  * ANY 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 "plan9.h"
-#include "fmt.h"
+#include <u.h>
+#include <libc.h>
 #include "fmtdef.h"
 
 /* format the output into f->to and return the number of characters fmted  */
--- a/libc/fltfmt.c
+++ b/libc/fltfmt.c
@@ -11,17 +11,10 @@
  * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
  * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
  */
-#include <stdio.h>
-#include <math.h>
+#include <u.h>
+#include <libc.h>
 #include <float.h>
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <stdarg.h>
 #include <ctype.h>
-#include <fmt.h>
-#include "plan9.h"
-#include "fmt.h"
 #include "fmtdef.h"
 
 enum
@@ -55,6 +48,7 @@
 	1e150, 1e151, 1e152, 1e153, 1e154, 1e155, 1e156, 1e157, 1e158, 1e159, 
 };
 
+#undef pow10
 #define  pow10(x)  fmtpow10(x)
 
 static double
--- a/libc/fmt.c
+++ b/libc/fmt.c
@@ -11,10 +11,8 @@
  * ANY 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 "plan9.h"
-#include "fmt.h"
+#include <u.h>
+#include <libc.h>
 #include "fmtdef.h"
 
 enum
--- a/libc/fmtprint.c
+++ b/libc/fmtprint.c
@@ -11,10 +11,8 @@
  * ANY 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 "plan9.h"
-#include "fmt.h"
+#include <u.h>
+#include <libc.h>
 #include "fmtdef.h"
 
 /*
--- a/libc/fmtquote.c
+++ b/libc/fmtquote.c
@@ -11,10 +11,8 @@
  * ANY 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 "plan9.h"
-#include "fmt.h"
+#include <u.h>
+#include <libc.h>
 #include "fmtdef.h"
 
 /*
--- a/libc/fmtrune.c
+++ b/libc/fmtrune.c
@@ -11,10 +11,8 @@
  * ANY 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 "plan9.h"
-#include "fmt.h"
+#include <u.h>
+#include <libc.h>
 #include "fmtdef.h"
 
 int
--- a/libc/fmtstr.c
+++ b/libc/fmtstr.c
@@ -11,10 +11,8 @@
  * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
  * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
  */
-#include <stdlib.h>
-#include <stdarg.h>
-#include "plan9.h"
-#include "fmt.h"
+#include <u.h>
+#include <libc.h>
 #include "fmtdef.h"
 
 char*
--- a/libc/fmtvprint.c
+++ b/libc/fmtvprint.c
@@ -11,10 +11,8 @@
  * ANY 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 "plan9.h"
-#include "fmt.h"
+#include <u.h>
+#include <libc.h>
 #include "fmtdef.h"
 
 
--- a/libc/pow10.c
+++ b/libc/pow10.c
@@ -11,10 +11,8 @@
  * ANY 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 "plan9.h"
-#include "fmt.h"
+#include <u.h>
+#include <libc.h>
 #include "fmtdef.h"
 
 /*
--- a/libc/print.c
+++ b/libc/print.c
@@ -11,9 +11,8 @@
  * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
  * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
  */
-#include <stdarg.h>
-#include "plan9.h"
-#include "fmt.h"
+#include <u.h>
+#include <libc.h>
 #include "fmtdef.h"
 
 int
--- a/libc/runefmtstr.c
+++ b/libc/runefmtstr.c
@@ -11,10 +11,8 @@
  * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
  * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
  */
-#include <stdarg.h>
-#include <stdlib.h>
-#include "plan9.h"
-#include "fmt.h"
+#include <u.h>
+#include <libc.h>
 #include "fmtdef.h"
 
 Rune*
--- a/libc/runeseprint.c
+++ b/libc/runeseprint.c
@@ -11,10 +11,8 @@
  * ANY 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 "plan9.h"
-#include "fmt.h"
+#include <u.h>
+#include <libc.h>
 #include "fmtdef.h"
 
 Rune*
--- a/libc/runesmprint.c
+++ b/libc/runesmprint.c
@@ -11,10 +11,8 @@
  * ANY 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 "plan9.h"
-#include "fmt.h"
+#include <u.h>
+#include <libc.h>
 #include "fmtdef.h"
 
 Rune*
--- a/libc/runesnprint.c
+++ b/libc/runesnprint.c
@@ -11,10 +11,8 @@
  * ANY 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 "plan9.h"
-#include "fmt.h"
+#include <u.h>
+#include <libc.h>
 #include "fmtdef.h"
 
 int
--- a/libc/runesprint.c
+++ b/libc/runesprint.c
@@ -11,10 +11,8 @@
  * ANY 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 "plan9.h"
-#include "fmt.h"
+#include <u.h>
+#include <libc.h>
 #include "fmtdef.h"
 
 int
--- a/libc/runevseprint.c
+++ b/libc/runevseprint.c
@@ -11,10 +11,8 @@
  * ANY 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 "plan9.h"
-#include "fmt.h"
+#include <u.h>
+#include <libc.h>
 #include "fmtdef.h"
 
 Rune*
--- a/libc/runevsmprint.c
+++ b/libc/runevsmprint.c
@@ -11,22 +11,9 @@
  * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
  * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
  */
-/*
- * Plan 9 port version must include libc.h in order to 
- * get Plan 9 debugging malloc, which sometimes returns
- * different pointers than the standard malloc. 
- */
-#ifdef PLAN9PORT
 #include <u.h>
 #include <libc.h>
 #include "fmtdef.h"
-#else
-#include <stdlib.h>
-#include <string.h>
-#include "plan9.h"
-#include "fmt.h"
-#include "fmtdef.h"
-#endif
 
 static int
 runeFmtStrFlush(Fmt *f)
--- a/libc/runevsnprint.c
+++ b/libc/runevsnprint.c
@@ -11,10 +11,8 @@
  * ANY 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 "plan9.h"
-#include "fmt.h"
+#include <u.h>
+#include <libc.h>
 #include "fmtdef.h"
 
 int
--- a/libc/seprint.c
+++ b/libc/seprint.c
@@ -11,9 +11,8 @@
  * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
  * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
  */
-#include <stdarg.h>
-#include "plan9.h"
-#include "fmt.h"
+#include <u.h>
+#include <libc.h>
 #include "fmtdef.h"
 
 char*
--- a/libc/smprint.c
+++ b/libc/smprint.c
@@ -11,9 +11,8 @@
  * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
  * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
  */
-#include <stdarg.h>
-#include "plan9.h"
-#include "fmt.h"
+#include <u.h>
+#include <libc.h>
 #include "fmtdef.h"
 
 char*
--- a/libc/snprint.c
+++ b/libc/snprint.c
@@ -11,9 +11,8 @@
  * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
  * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
  */
-#include <stdarg.h>
-#include "plan9.h"
-#include "fmt.h"
+#include <u.h>
+#include <libc.h>
 #include "fmtdef.h"
 
 int
--- a/libc/sprint.c
+++ b/libc/sprint.c
@@ -11,10 +11,8 @@
  * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
  * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
  */
-#include <stdarg.h>
-#include <fmt.h>
-#include "plan9.h"
-#include "fmt.h"
+#include <u.h>
+#include <libc.h>
 #include "fmtdef.h"
 
 int
--- a/libc/strtod.c
+++ b/libc/strtod.c
@@ -11,14 +11,8 @@
  * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
  * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
  */
-#include <stdlib.h>
-#include <math.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include "plan9.h"
-#include "fmt.h"
+#include <u.h>
+#include <libc.h>
 #include "fmtdef.h"
 
 static ulong
--- a/libc/vfprint.c
+++ b/libc/vfprint.c
@@ -11,9 +11,8 @@
  * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
  * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
  */
-#include <stdarg.h>
-#include "plan9.h"
-#include "fmt.h"
+#include <u.h>
+#include <libc.h>
 #include "fmtdef.h"
 
 int
--- a/libc/vseprint.c
+++ b/libc/vseprint.c
@@ -11,9 +11,8 @@
  * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
  * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
  */
-#include <stdarg.h>
-#include "plan9.h"
-#include "fmt.h"
+#include <u.h>
+#include <libc.h>
 #include "fmtdef.h"
 
 char*
--- a/libc/vsmprint.c
+++ b/libc/vsmprint.c
@@ -11,22 +11,10 @@
  * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
  * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
  */
-/*
- * Plan 9 port version must include libc.h in order to 
- * get Plan 9 debugging malloc, which sometimes returns
- * different pointers than the standard malloc. 
- */
-#ifdef PLAN9PORT
+
 #include <u.h>
 #include <libc.h>
 #include "fmtdef.h"
-#else
-#include <stdlib.h>
-#include <string.h>
-#include "plan9.h"
-#include "fmt.h"
-#include "fmtdef.h"
-#endif
 
 static int
 fmtStrFlush(Fmt *f)
--- a/libc/vsnprint.c
+++ b/libc/vsnprint.c
@@ -11,10 +11,8 @@
  * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
  * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
  */
-#include <stdlib.h>
-#include <stdarg.h>
-#include "plan9.h"
-#include "fmt.h"
+#include <u.h>
+#include <libc.h>
 #include "fmtdef.h"
 
 int