warning: src/lib9/fmt/dorfmt.c:64 unreachable code RETURN
warning: src/lib9/fmt/fltfmt.c:184 set and not used: p
warning: src/lib9/utf/utflen.c:35 unreachable code RETURN
warning: src/lib9/utf/utfrrune.c:45 unreachable code RETURN
warning: src/lib9/utf/utfrune.c:44 unreachable code RETURN
LGTM=rsc
R=rsc, iant, gobot
CC=golang-codereviews
https://golang.org/cl/
57170052
+// +build !plan9
+
/*
Plan 9 from User Space src/lib9/errstr.c
http://code.swtch.com/plan9port/src/tip/src/lib9/errstr.c
#include <u.h>
#include <errno.h>
-#include <string.h>
#include <libc.h>
enum
if(fmt == nil)
return -1;
}
- return 0; /* not reached */
}
--- /dev/null
+// +build plan9
+
+/*
+ * The authors of this software are Rob Pike and Ken Thompson,
+ * with contributions from Mike Burrows and Sean Dorward.
+ *
+ * Copyright (c) 2002-2006 by Lucent Technologies.
+ * Portions Copyright (c) 2004 Google Inc.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software and in all copies of the supporting
+ * documentation for such software.
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES
+ * NOR GOOGLE INC MAKE ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING
+ * THE MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ */
+
+#include <u.h>
+#include <libc.h>
+#include "fmtdef.h"
+
+int
+__errfmt(Fmt *f)
+{
+ char buf[ERRMAX];
+
+ rerrstr(buf, sizeof buf);
+ return __fmtcpy(f, buf, utflen(buf), strlen(buf));
+}
* so that it has a nonzero first digit.
*/
abort();
+ return 0;
}
/*
se[i++] = '0';
while(i > 0)
*p++ = se[--i];
- *p++ = '\0';
+ *p = '\0';
}
/*
static void
xdtoa(double f, char *s, int *exp, int *neg, int *ns)
{
- int d, e2, e, ee, i, ndigit, oerrno;
+ int d, e2, e, ee, i, ndigit;
+ int oerrno;
char c;
char tmp[NSIGNIF+10];
double g;
f->to = buf;
f->stop = buf + size;
f->flush = __fmtFdFlush;
- f->farg = (void*)(uintptr_t)fd;
+ f->farg = (void*)(uintptr)fd;
f->flags = 0;
f->nfmt = 0;
fmtlocaleinit(f, nil, nil, nil);
* REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
*/
-#define _BSD_SOURCE 1
-#include <string.h>
+#include <u.h>
+#include <libc.h>
#include "utf.h"
#include "utfdef.h"
s += chartorune(&rune, s);
n++;
}
- return 0;
}
* REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
*/
-#include <string.h>
+#include <u.h>
+#include <libc.h>
#include "utf.h"
#include "utfdef.h"
s1 = s;
s += c1;
}
- return 0;
}
* REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
*/
-#include <string.h>
+#include <u.h>
+#include <libc.h>
#include "utf.h"
#include "utfdef.h"
return (char*)s;
s += n;
}
- return 0;
}
* REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
*/
-#include <string.h>
+#include <u.h>
+#include <libc.h>
#include "utf.h"
#include "utfdef.h"