Commit 705d7c16 authored by David du Colombier's avatar David du Colombier

lib9: fix inconsistencies and warnings on Plan 9

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
parent e0a55a6c
// +build !plan9
/*
Plan 9 from User Space src/lib9/errstr.c
http://code.swtch.com/plan9port/src/tip/src/lib9/errstr.c
......@@ -32,7 +34,6 @@ THE SOFTWARE.
#include <u.h>
#include <errno.h>
#include <string.h>
#include <libc.h>
enum
......
......@@ -61,5 +61,4 @@ dorfmt(Fmt *f, const Rune *fmt)
if(fmt == nil)
return -1;
}
return 0; /* not reached */
}
// +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));
}
......@@ -154,6 +154,7 @@ xsub1(char *a, int n)
* so that it has a nonzero first digit.
*/
abort();
return 0;
}
/*
......@@ -180,7 +181,7 @@ xfmtexp(char *p, int e, int ucase)
se[i++] = '0';
while(i > 0)
*p++ = se[--i];
*p++ = '\0';
*p = '\0';
}
/*
......@@ -192,7 +193,8 @@ xfmtexp(char *p, int e, int ucase)
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;
......
......@@ -43,7 +43,7 @@ fmtfdinit(Fmt *f, int fd, char *buf, int size)
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);
......
......@@ -11,8 +11,8 @@
* 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"
......
......@@ -32,5 +32,4 @@ utflen(const char *s)
s += chartorune(&rune, s);
n++;
}
return 0;
}
......@@ -11,7 +11,8 @@
* 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"
......@@ -42,5 +43,4 @@ utfrrune(const char *s, Rune c)
s1 = s;
s += c1;
}
return 0;
}
......@@ -11,7 +11,8 @@
* 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"
......@@ -41,5 +42,4 @@ utfrune(const char *s, Rune c)
return (char*)s;
s += n;
}
return 0;
}
......@@ -11,7 +11,8 @@
* 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"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment