Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms.
diff --git a/src/lib9/debugmalloc.c b/src/lib9/debugmalloc.c
index 3958e24..8df2721 100644
--- a/src/lib9/debugmalloc.c
+++ b/src/lib9/debugmalloc.c
@@ -111,13 +111,13 @@
void *v;
if(n == 0)
n++;
-//fprint(2, "%s %d malloc\n", argv0, getpid());
+/*fprint(2, "%s %d malloc\n", argv0, getpid()); */
lock(&malloclock);
mallocpid = getpid();
v = malloc(n+Overhead);
v = mark(v, getcallerpc(&n), n, MallocMagic);
unlock(&malloclock);
-//fprint(2, "%s %d donemalloc\n", argv0, getpid());
+/*fprint(2, "%s %d donemalloc\n", argv0, getpid()); */
return v;
}
@@ -127,13 +127,13 @@
if(v == nil)
return;
-//fprint(2, "%s %d free\n", argv0, getpid());
+/*fprint(2, "%s %d free\n", argv0, getpid()); */
lock(&malloclock);
mallocpid = getpid();
v = mark(v, getcallerpc(&v), 0, FreeMagic);
free(v);
unlock(&malloclock);
-//fprint(2, "%s %d donefree\n", argv0, getpid());
+/*fprint(2, "%s %d donefree\n", argv0, getpid()); */
}
void*
@@ -141,26 +141,26 @@
{
void *v;
-//fprint(2, "%s %d calloc\n", argv0, getpid());
+/*fprint(2, "%s %d calloc\n", argv0, getpid()); */
lock(&malloclock);
mallocpid = getpid();
v = calloc(a*b+Overhead, 1);
v = mark(v, getcallerpc(&a), a*b, CallocMagic);
unlock(&malloclock);
-//fprint(2, "%s %d donecalloc\n", argv0, getpid());
+/*fprint(2, "%s %d donecalloc\n", argv0, getpid()); */
return v;
}
void*
p9realloc(void *v, ulong n)
{
-//fprint(2, "%s %d realloc\n", argv0, getpid());
+/*fprint(2, "%s %d realloc\n", argv0, getpid()); */
lock(&malloclock);
mallocpid = getpid();
v = mark(v, getcallerpc(&v), 0, CheckMagic);
v = realloc(v, n+Overhead);
v = mark(v, getcallerpc(&v), n, ReallocMagic);
unlock(&malloclock);
-//fprint(2, "%s %d donerealloc\n", argv0, getpid());
+/*fprint(2, "%s %d donerealloc\n", argv0, getpid()); */
return v;
}
diff --git a/src/lib9/encodefmt.c b/src/lib9/encodefmt.c
index 9445809..5033505 100644
--- a/src/lib9/encodefmt.c
+++ b/src/lib9/encodefmt.c
@@ -9,7 +9,7 @@
int ilen;
int rv;
uchar *b;
- char obuf[64]; // rsc optimization
+ char obuf[64]; /* rsc optimization */
b = va_arg(f->args, uchar*);
if(b == 0)
@@ -44,7 +44,7 @@
} else
buf = obuf;
- // convert
+ /* convert */
out = buf;
switch(f->r){
case '<':
diff --git a/src/lib9/errstr.c b/src/lib9/errstr.c
index af989f4..caf7153 100644
--- a/src/lib9/errstr.c
+++ b/src/lib9/errstr.c
@@ -12,7 +12,7 @@
enum
{
- EPLAN9 = 0x19283745,
+ EPLAN9 = 0x19283745
};
char *(*_syserrstr)(void);
diff --git a/src/lib9/fmt/fltfmt.c b/src/lib9/fmt/fltfmt.c
index 14ad867..9c94f15 100644
--- a/src/lib9/fmt/fltfmt.c
+++ b/src/lib9/fmt/fltfmt.c
@@ -286,7 +286,7 @@
if(e >= -5 && e <= prec) {
c1 = -e - 1;
c4 = prec - e;
- chr = 'h'; // flag for 'f' style
+ chr = 'h'; /* flag for 'f' style */
}
break;
case 'f':
diff --git a/src/lib9/fmt/fmtquote.c b/src/lib9/fmt/fmtquote.c
index b6f2e17..2304c4e 100644
--- a/src/lib9/fmt/fmtquote.c
+++ b/src/lib9/fmt/fmtquote.c
@@ -209,7 +209,7 @@
outlen = (char*)f->stop - (char*)f->to;
__quotesetup(s, r, nin, outlen, &q, f->flags&FmtSharp, f->runes);
-//print("bytes in %d bytes out %d runes in %d runesout %d\n", q.nbytesin, q.nbytesout, q.nrunesin, q.nrunesout);
+/*print("bytes in %d bytes out %d runes in %d runesout %d\n", q.nbytesin, q.nbytesout, q.nrunesin, q.nrunesout); */
if(runesin){
if(!q.quoted)
diff --git a/src/lib9/fmt/strtod.c b/src/lib9/fmt/strtod.c
index fbc1c59..c19c284 100644
--- a/src/lib9/fmt/strtod.c
+++ b/src/lib9/fmt/strtod.c
@@ -67,7 +67,7 @@
S4, /* _+#.# #S4 eS5 */
S5, /* _+#.#e +S6 #S7 */
S6, /* _+#.#e+ #S7 */
- S7, /* _+#.#e+# #S7 */
+ S7 /* _+#.#e+# #S7 */
};
static int xcmp(char*, char*);
diff --git a/src/lib9/notify.c b/src/lib9/notify.c
index 2a562b6..8480b24 100644
--- a/src/lib9/notify.c
+++ b/src/lib9/notify.c
@@ -37,7 +37,7 @@
enum
{
Restart = 1<<0,
- Ignore = 1<<1,
+ Ignore = 1<<1
};
static Sig sigs[] = {
diff --git a/src/lib9/utf/rune.c b/src/lib9/utf/rune.c
index 88484f6..3d6831b 100644
--- a/src/lib9/utf/rune.c
+++ b/src/lib9/utf/rune.c
@@ -37,7 +37,7 @@
Maskx = (1<<Bitx)-1, /* 0011 1111 */
Testx = Maskx ^ 0xFF, /* 1100 0000 */
- Bad = Runeerror,
+ Bad = Runeerror
};
int
diff --git a/src/lib9/utf/utfecpy.c b/src/lib9/utf/utfecpy.c
index f254c13..cf3535f 100644
--- a/src/lib9/utf/utfecpy.c
+++ b/src/lib9/utf/utfecpy.c
@@ -11,6 +11,7 @@
* ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
*/
+#define _BSD_SOURCE 1 /* memccpy */
#include <stdarg.h>
#include <string.h>
#include "plan9.h"