summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2022-10-04 15:07:54 +0300
committerToomas Soome <tsoome@me.com>2022-10-14 23:49:44 +0300
commit8a67df42cf817fc66635eb83ffe3fc2f8216300a (patch)
treeab5a88800cb2a97b4b09d348dad7d1d8501a4f25 /usr/src
parent2067ad9da908e7634f4b17778a0523d3acca8102 (diff)
downloadillumos-joyent-8a67df42cf817fc66635eb83ffe3fc2f8216300a.tar.gz
15046 libc: unused variable
Reviewed by: Jason King <jason.brian.king+illumos@gmail.com> Approved by: Dan McDonald <danmcd@mnx.io>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/lib/libc/port/print/doprnt.c77
-rw-r--r--usr/src/lib/libc/port/stdio/_endopen.c3
-rw-r--r--usr/src/lib/libc/port/stdio/doscan.c16
-rw-r--r--usr/src/lib/libc/port/stdio/open_memstream.c1
-rw-r--r--usr/src/lib/libc/port/stdio/open_wmemstream.c3
-rw-r--r--usr/src/lib/libc/port/threads/assfail.c2
6 files changed, 47 insertions, 55 deletions
diff --git a/usr/src/lib/libc/port/print/doprnt.c b/usr/src/lib/libc/port/print/doprnt.c
index 04f1e4ad0a..111591b5d9 100644
--- a/usr/src/lib/libc/port/print/doprnt.c
+++ b/usr/src/lib/libc/port/print/doprnt.c
@@ -167,8 +167,8 @@ static const wchar_t widenullstr[] = L"(null)";
#define PAD(s, n) { ssize_t nn; \
for (nn = n; nn > PAD_LEN; nn -= PAD_LEN) \
- if (!_dowrite(s, PAD_LEN, iop, &bufptr)) \
- return (EOF); \
+ if (!_dowrite(s, PAD_LEN, iop, &bufptr)) \
+ return (EOF); \
PUT(s, nn); \
}
@@ -298,8 +298,8 @@ _dowrite(const char *p, ssize_t n, FILE *iop, unsigned char **ptrptr)
#ifdef _WIDE
static int
put_wide(FILE *iop, unsigned char **bufptr,
- unsigned char *bufferend, wchar_t *p, size_t n,
- int sflag)
+ unsigned char *bufferend, wchar_t *p, size_t n,
+ int sflag)
{
unsigned char *newbufptr;
wchar_t *q;
@@ -357,8 +357,8 @@ put_wide(FILE *iop, unsigned char **bufptr,
static int
pad_wide(FILE *iop, unsigned char **bufptr,
- unsigned char *bufferend, const char *s, size_t n,
- int sflag)
+ unsigned char *bufferend, const char *s, size_t n,
+ int sflag)
{
unsigned char *newbufptr;
ssize_t nn;
@@ -454,19 +454,21 @@ _ndoprnt(const char *format, va_list in_args, FILE *iop, int prflag)
/* Starting and ending points for value to be printed */
char *bp;
char *p;
+
+ /* Field width and precision */
+ ssize_t preco;
+ char tmpbuf[10];
+ int retcode;
#endif /* _WIDE */
/* Field width and precision */
int prec = 0;
ssize_t width;
ssize_t num;
wchar_t *wp;
- ssize_t preco;
ssize_t wcount = 0;
- char tmpbuf[10];
char wflag;
char lflag;
int quote; /* ' */
- int retcode;
#ifdef _WIDE
/* Format code */
@@ -561,7 +563,7 @@ _ndoprnt(const char *format, va_list in_args, FILE *iop, int prflag)
int fpos = 1; /* 1 if first positional parameter */
stva_list args, /* used to step through the argument list */
- sargs; /* used to save the start of the arg list */
+ sargs; /* used to save the start of the arg list */
stva_list bargs; /* used to restore args if positional width */
/* or precision */
stva_list arglst[MAXARGS]; /* array giving appropriate values */
@@ -592,12 +594,14 @@ _ndoprnt(const char *format, va_list in_args, FILE *iop, int prflag)
/* if first I/O to the stream get a buffer */
/* Note that iop->_base should not equal 0 for sprintf and vsprintf */
if (iop->_base == 0) {
- if (_findbuf(iop) == 0)
- return (EOF);
- /* _findbuf leaves _cnt set to 0 which is the wrong thing to do */
- /* for fully buffered files */
- if (!(iop->_flag & (_IOLBF|_IONBF)))
- iop->_cnt = _bufend(iop) - iop->_base;
+ if (_findbuf(iop) == 0)
+ return (EOF);
+ /*
+ * _findbuf leaves _cnt set to 0 which is the wrong thing
+ * to do for fully buffered files
+ */
+ if (!(iop->_flag & (_IOLBF|_IONBF)))
+ iop->_cnt = _bufend(iop) - iop->_base;
}
#ifdef _WIDE
}
@@ -608,7 +612,7 @@ _ndoprnt(const char *format, va_list in_args, FILE *iop, int prflag)
if (sflag) {
maxcount = (size_t)iop->_cnt;
bufferend = (unsigned char *)(((wchar_t *)iop->_ptr) +
- maxcount);
+ maxcount);
} else {
bufferend = _bufend(iop);
}
@@ -833,7 +837,7 @@ _ndoprnt(const char *format, va_list in_args, FILE *iop, int prflag)
case '7':
case '8':
case '9':
- { num = fcode - '0';
+ num = fcode - '0';
while (_M_ISDIGIT(fcode = *format)) {
num = num * 10 + fcode - '0';
format++;
@@ -843,7 +847,6 @@ _ndoprnt(const char *format, va_list in_args, FILE *iop, int prflag)
else
width = num;
goto charswitch;
- }
/* Scan the length modifier */
case 'l':
@@ -1061,7 +1064,7 @@ _ndoprnt(const char *format, va_list in_args, FILE *iop, int prflag)
lll /= 10;
#ifdef _WIDE
*--bp = (wchar_t)
- (tll - lll * 10 + '0');
+ (tll - lll * 10 + '0');
#else /* _WIDE */
*--bp = (char) \
(tll - lll * 10 + '0');
@@ -1378,7 +1381,7 @@ _ndoprnt(const char *format, va_list in_args, FILE *iop, int prflag)
nn = exp;
if (nn < 0)
- nn = -nn;
+ nn = -nn;
for (; nn > 9; nn /= 10)
*--suffix = todigit(nn % 10);
*--suffix = todigit(nn);
@@ -1473,7 +1476,7 @@ _ndoprnt(const char *format, va_list in_args, FILE *iop, int prflag)
if (buf[0] != '0') {
int nn = decpt - 1;
if (nn < 0)
- nn = -nn;
+ nn = -nn;
for (; nn > 9; nn /= 10)
*--suffix = todigit(nn % 10);
*--suffix = todigit(nn);
@@ -1676,8 +1679,8 @@ wide_C:
wflag = 1;
#else /* _WIDE */
if (temp) {
- if ((retcode = wctomb(buf, temp))
- == -1) {
+ retcode = wctomb(buf, temp);
+ if (retcode == -1) {
errno = EILSEQ;
return (EOF);
} else {
@@ -1701,8 +1704,8 @@ wide_C:
temp = va_arg(args.ap, wchar_t);
if (temp) {
- if ((retcode = wctomb(buf, temp))
- == -1) {
+ retcode = wctomb(buf, temp);
+ if (retcode == -1) {
p = (bp = buf) + 1;
} else {
p = (bp = buf) + retcode;
@@ -1842,9 +1845,6 @@ wide_S:
bp = wstr;
p = wstr + nwc;
} else {
- size_t nnwc;
- int len;
- char *s;
wchar_t *wstr;
bpsize = sizeof (wchar_t) * prec;
@@ -1925,11 +1925,10 @@ wide_S:
}
wptr = wp;
}
- if ((sec_display = wcswidth(wptr, nwc))
- == -1) {
+ sec_display = wcswidth(wptr, nwc);
+ if (sec_display == -1) {
sec_display =
- _rec_scrswidth
- (wptr, nwc);
+ _rec_scrswidth(wptr, nwc);
}
mbs_err:
if (wp)
@@ -1986,14 +1985,13 @@ wide_S:
continue;
}
if ((nbytes = mbtowc(&wc, qp,
- MB_LEN_MAX)) == -1) {
+ MB_LEN_MAX)) == -1) {
/* print illegal char */
nbytes = 1;
ncol = 1;
} else {
- if ((ncol =
- _scrwidth(wc))
- == 0) {
+ ncol = _scrwidth(wc);
+ if (ncol == 0) {
ncol = 1;
}
}
@@ -2179,7 +2177,7 @@ wide_S:
char *bufp;
long printn;
printn = (wchar_t *)(uintptr_t)p -
- (wchar_t *)(uintptr_t)bp;
+ (wchar_t *)(uintptr_t)bp;
bufp = buf;
while (printn > 0) {
if ((cnt = wctomb(buf, *wp)) < 0)
@@ -2331,8 +2329,7 @@ _mkarglst(char *fmt, stva_list args, stva_list arglst[], int prflag)
case '*': /* int argument used for value */
/* check if there is a positional parameter */
#ifdef _WIDE
- if ((*fmt >= 0) && (*fmt < 256) &&
- isdigit(*fmt))
+ if ((*fmt >= 0) && (*fmt < 256) && isdigit(*fmt))
#else /* _WIDE */
if (isdigit(*fmt))
#endif /* _WIDE */
diff --git a/usr/src/lib/libc/port/stdio/_endopen.c b/usr/src/lib/libc/port/stdio/_endopen.c
index fa548f6385..ebcaa07439 100644
--- a/usr/src/lib/libc/port/stdio/_endopen.c
+++ b/usr/src/lib/libc/port/stdio/_endopen.c
@@ -55,8 +55,7 @@
FILE *
_endopen(const char *name, const char *type, FILE *iop, int largefile)
{
- int oflag, fd, fflag, eflag, plusflag, xflag;
- const char *echr;
+ int oflag, fd, fflag;
if (iop == NULL)
return (NULL);
diff --git a/usr/src/lib/libc/port/stdio/doscan.c b/usr/src/lib/libc/port/stdio/doscan.c
index fda4d5c2ea..7d49797578 100644
--- a/usr/src/lib/libc/port/stdio/doscan.c
+++ b/usr/src/lib/libc/port/stdio/doscan.c
@@ -596,7 +596,7 @@ charswitch: /* target of a goto 8-( */
/* ****************************************************************** */
static int
number(int *chcount, int *flag_eof, int stow, int type, int len, int size,
- FILE *iop, va_list *listp)
+ FILE *iop, va_list *listp)
{
char numbuf[64];
char *np = numbuf;
@@ -841,7 +841,7 @@ readchar(FILE *iop, int *chcount)
static int
string(int *chcount, int *flag_eof, int stow, int type, int len, char *tab,
- FILE *iop, va_list *listp)
+ FILE *iop, va_list *listp)
{
int ch;
char *ptr;
@@ -927,7 +927,6 @@ _mkarglst(const char *fmt, stva_list args, stva_list arglst[])
fmt += STRSPN(fmt, SPNSTR2);
if (*fmt == '[') {
- int i;
fmt++; /* has to be at least on item in scan list */
if (*fmt == ']') {
fmt++;
@@ -943,6 +942,8 @@ _mkarglst(const char *fmt, stva_list args, stva_list arglst[])
} else if (isascii(*fmt)) {
fmt++;
} else {
+ int i;
+
i = mblen((const char *)
fmt, MB_CUR_MAX);
if (i <= 0) {
@@ -972,12 +973,11 @@ _mkarglst(const char *fmt, stva_list args, stva_list arglst[])
#ifdef _WIDE
static int
wstring(int *chcount, int *flag_eof, int stow, int type,
- int len, FILE *iop, va_list *listp)
+ int len, FILE *iop, va_list *listp)
{
wint_t wch;
wchar_t *ptr;
wchar_t *wstart;
- int dummy;
wstart = ptr = stow ? va_arg(*listp, wchar_t *) : NULL;
@@ -1008,7 +1008,7 @@ wstring(int *chcount, int *flag_eof, int stow, int type,
#else /* _WIDE */
static int
wstring(int *chcount, int *flag_eof, int stow, int type, int len, FILE *iop,
- va_list *listp)
+ va_list *listp)
{
int wch;
wchar_t *ptr;
@@ -1118,7 +1118,7 @@ _watoi(wchar_t *fmt)
/* ARGSUSED3 */
static int
wbrstring(int *chcount, int *flag_eof, int stow, int type,
- int len, FILE *iop, unsigned char *brstr, va_list *listp)
+ int len, FILE *iop, unsigned char *brstr, va_list *listp)
{
wint_t wch;
int i;
@@ -1182,7 +1182,7 @@ wbrstring(int *chcount, int *flag_eof, int stow, int type,
#ifdef _WIDE
static int
brstring(int *chcount, int *flag_eof, int stow, int type,
- int len, FILE *iop, unsigned char *brstr, va_list *listp)
+ int len, FILE *iop, unsigned char *brstr, va_list *listp)
{
wint_t wch;
int i;
diff --git a/usr/src/lib/libc/port/stdio/open_memstream.c b/usr/src/lib/libc/port/stdio/open_memstream.c
index a841f44fb5..01d5af80ce 100644
--- a/usr/src/lib/libc/port/stdio/open_memstream.c
+++ b/usr/src/lib/libc/port/stdio/open_memstream.c
@@ -203,7 +203,6 @@ open_memstream_close(FILE *iop)
FILE *
open_memstream(char **bufp, size_t *sizep)
{
- int err;
FILE *iop;
memstream_t *memp;
diff --git a/usr/src/lib/libc/port/stdio/open_wmemstream.c b/usr/src/lib/libc/port/stdio/open_wmemstream.c
index d46c5e34ce..a3968328f2 100644
--- a/usr/src/lib/libc/port/stdio/open_wmemstream.c
+++ b/usr/src/lib/libc/port/stdio/open_wmemstream.c
@@ -54,7 +54,7 @@ static ssize_t
open_wmemstream_write(FILE *iop, const char *buf, size_t nbytes)
{
wmemstream_t *wmemp = _xdata(iop);
- size_t newsize, mbscount;
+ size_t newsize;
ssize_t nwritten = 0;
int ret;
@@ -165,7 +165,6 @@ open_wmemstream_close(FILE *iop)
FILE *
open_wmemstream(wchar_t **bufp, size_t *sizep)
{
- int err;
FILE *iop;
wmemstream_t *wmemp;
diff --git a/usr/src/lib/libc/port/threads/assfail.c b/usr/src/lib/libc/port/threads/assfail.c
index 4af2fc5664..40fe162b4a 100644
--- a/usr/src/lib/libc/port/threads/assfail.c
+++ b/usr/src/lib/libc/port/threads/assfail.c
@@ -65,8 +65,6 @@ static void
Abort(const char *msg, size_t buflen)
{
ulwp_t *self;
- struct sigaction act;
- sigset_t sigmask;
/* to help with core file debugging */
panicstr = msg;