Lukemify (WARNS=4)
This commit is contained in:
parent
19a92f1b8c
commit
7f812cd511
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: emit.c,v 1.4 2004/06/20 22:20:16 jmc Exp $ */
|
/* $NetBSD: emit.c,v 1.5 2009/04/15 01:20:57 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||||
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#if defined(__RCSID) && !defined(lint)
|
#if defined(__RCSID) && !defined(lint)
|
||||||
__RCSID("$NetBSD: emit.c,v 1.4 2004/06/20 22:20:16 jmc Exp $");
|
__RCSID("$NetBSD: emit.c,v 1.5 2009/04/15 01:20:57 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -206,7 +206,7 @@ void
|
|||||||
outint(int i)
|
outint(int i)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ((ob.o_end - ob.o_nxt) < 3 * sizeof (int))
|
if ((size_t)(ob.o_end - ob.o_nxt) < 3 * sizeof (int))
|
||||||
outxbuf();
|
outxbuf();
|
||||||
ob.o_nxt += sprintf(ob.o_nxt, "%d", i);
|
ob.o_nxt += sprintf(ob.o_nxt, "%d", i);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: inittyp.c,v 1.10 2008/09/26 22:52:24 matt Exp $ */
|
/* $NetBSD: inittyp.c,v 1.11 2009/04/15 01:20:57 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||||
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#if defined(__RCSID) && !defined(lint)
|
#if defined(__RCSID) && !defined(lint)
|
||||||
__RCSID("$NetBSD: inittyp.c,v 1.10 2008/09/26 22:52:24 matt Exp $");
|
__RCSID("$NetBSD: inittyp.c,v 1.11 2009/04/15 01:20:57 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
@ -57,7 +57,7 @@ ttab_t ttab[NTSPEC];
|
|||||||
void
|
void
|
||||||
inittyp(void)
|
inittyp(void)
|
||||||
{
|
{
|
||||||
int i;
|
size_t i;
|
||||||
static const struct {
|
static const struct {
|
||||||
tspec_t it_tspec;
|
tspec_t it_tspec;
|
||||||
ttab_t it_ttab;
|
ttab_t it_ttab;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: lint.h,v 1.12 2008/09/26 22:52:24 matt Exp $ */
|
/* $NetBSD: lint.h,v 1.13 2009/04/15 01:20:57 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||||
@ -85,8 +85,8 @@ typedef enum {
|
|||||||
* size of types, name and classification
|
* size of types, name and classification
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int tt_sz; /* size in bits */
|
size_t tt_sz; /* size in bits */
|
||||||
int tt_psz; /* size, different from tt_sz
|
size_t tt_psz; /* size, different from tt_sz
|
||||||
if pflag is set */
|
if pflag is set */
|
||||||
tspec_t tt_styp; /* signed counterpart */
|
tspec_t tt_styp; /* signed counterpart */
|
||||||
tspec_t tt_utyp; /* unsigned counterpart */
|
tspec_t tt_utyp; /* unsigned counterpart */
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: decl.c,v 1.45 2009/03/02 20:53:10 christos Exp $ */
|
/* $NetBSD: decl.c,v 1.46 2009/04/15 01:20:57 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
|
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
|
||||||
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#if defined(__RCSID) && !defined(lint)
|
#if defined(__RCSID) && !defined(lint)
|
||||||
__RCSID("$NetBSD: decl.c,v 1.45 2009/03/02 20:53:10 christos Exp $");
|
__RCSID("$NetBSD: decl.c,v 1.46 2009/04/15 01:20:57 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -863,7 +863,7 @@ length(type_t *tp, const char *name)
|
|||||||
int
|
int
|
||||||
getbound(type_t *tp)
|
getbound(type_t *tp)
|
||||||
{
|
{
|
||||||
int a;
|
size_t a;
|
||||||
tspec_t t;
|
tspec_t t;
|
||||||
|
|
||||||
while (tp && tp->t_tspec == ARRAY)
|
while (tp && tp->t_tspec == ARRAY)
|
||||||
@ -1079,7 +1079,7 @@ decl1str(sym_t *dsym)
|
|||||||
tp->t_flen = size(t);
|
tp->t_flen = size(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((len = tp->t_flen) < 0 || len > size(t)) {
|
if ((len = tp->t_flen) < 0 || len > (ssize_t)size(t)) {
|
||||||
/* illegal bit-field size */
|
/* illegal bit-field size */
|
||||||
error(36);
|
error(36);
|
||||||
tp->t_flen = size(t);
|
tp->t_flen = size(t);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: err.c,v 1.39 2009/04/13 21:17:37 christos Exp $ */
|
/* $NetBSD: err.c,v 1.40 2009/04/15 01:20:57 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||||
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#if defined(__RCSID) && !defined(lint)
|
#if defined(__RCSID) && !defined(lint)
|
||||||
__RCSID("$NetBSD: err.c,v 1.39 2009/04/13 21:17:37 christos Exp $");
|
__RCSID("$NetBSD: err.c,v 1.40 2009/04/15 01:20:57 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -392,10 +392,10 @@ const char *msgs[] = {
|
|||||||
void
|
void
|
||||||
msglist(void)
|
msglist(void)
|
||||||
{
|
{
|
||||||
int i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; i < sizeof(msgs) / sizeof(msgs[0]); i++)
|
for (i = 0; i < sizeof(msgs) / sizeof(msgs[0]); i++)
|
||||||
printf("%d\t%s\n", i, msgs[i]);
|
printf("%zu\t%s\n", i, msgs[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: externs1.h,v 1.25 2009/03/02 20:53:10 christos Exp $ */
|
/* $NetBSD: externs1.h,v 1.26 2009/04/15 01:20:57 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||||
@ -99,7 +99,7 @@ extern int getfnid(const char *);
|
|||||||
extern void initmem(void);
|
extern void initmem(void);
|
||||||
|
|
||||||
extern void *getblk(size_t);
|
extern void *getblk(size_t);
|
||||||
extern void *getlblk(int, size_t);
|
extern void *getlblk(size_t, size_t);
|
||||||
extern void freeblk(void);
|
extern void freeblk(void);
|
||||||
extern void freelblk(int);
|
extern void freelblk(int);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: mem1.c,v 1.11 2004/06/20 22:20:17 jmc Exp $ */
|
/* $NetBSD: mem1.c,v 1.12 2009/04/15 01:20:57 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||||
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#if defined(__RCSID) && !defined(lint)
|
#if defined(__RCSID) && !defined(lint)
|
||||||
__RCSID("$NetBSD: mem1.c,v 1.11 2004/06/20 22:20:17 jmc Exp $");
|
__RCSID("$NetBSD: mem1.c,v 1.12 2009/04/15 01:20:57 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -250,7 +250,7 @@ initmem(void)
|
|||||||
* Allocate memory associated with level l.
|
* Allocate memory associated with level l.
|
||||||
*/
|
*/
|
||||||
void *
|
void *
|
||||||
getlblk(int l, size_t s)
|
getlblk(size_t l, size_t s)
|
||||||
{
|
{
|
||||||
|
|
||||||
while (l >= nmblks) {
|
while (l >= nmblks) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
%{
|
%{
|
||||||
/* $NetBSD: scan.l,v 1.42 2008/12/10 16:12:39 joerg Exp $ */
|
/* $NetBSD: scan.l,v 1.43 2009/04/15 01:20:57 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
|
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
|
||||||
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#if defined(__RCSID) && !defined(lint)
|
#if defined(__RCSID) && !defined(lint)
|
||||||
__RCSID("$NetBSD: scan.l,v 1.42 2008/12/10 16:12:39 joerg Exp $");
|
__RCSID("$NetBSD: scan.l,v 1.43 2009/04/15 01:20:57 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -274,7 +274,7 @@ initscan(void)
|
|||||||
{
|
{
|
||||||
struct kwtab *kw;
|
struct kwtab *kw;
|
||||||
sym_t *sym;
|
sym_t *sym;
|
||||||
int h, i;
|
size_t h, i;
|
||||||
uint64_t uq;
|
uint64_t uq;
|
||||||
|
|
||||||
for (kw = kwtab; kw->kw_name != NULL; kw++) {
|
for (kw = kwtab; kw->kw_name != NULL; kw++) {
|
||||||
@ -761,7 +761,8 @@ operator(int t, op_t o)
|
|||||||
static int
|
static int
|
||||||
ccon(void)
|
ccon(void)
|
||||||
{
|
{
|
||||||
int n, val, c;
|
size_t n;
|
||||||
|
int val, c;
|
||||||
char cv;
|
char cv;
|
||||||
|
|
||||||
n = 0;
|
n = 0;
|
||||||
@ -804,7 +805,8 @@ static int
|
|||||||
wccon(void)
|
wccon(void)
|
||||||
{
|
{
|
||||||
static char buf[MB_LEN_MAX + 1];
|
static char buf[MB_LEN_MAX + 1];
|
||||||
int i, c;
|
size_t i;
|
||||||
|
int c;
|
||||||
wchar_t wc;
|
wchar_t wc;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
@ -1098,7 +1100,8 @@ comment(void)
|
|||||||
};
|
};
|
||||||
char keywd[32];
|
char keywd[32];
|
||||||
char arg[32];
|
char arg[32];
|
||||||
int l, i, a;
|
size_t l, i;
|
||||||
|
int a;
|
||||||
int eoc;
|
int eoc;
|
||||||
|
|
||||||
eoc = 0;
|
eoc = 0;
|
||||||
@ -1242,7 +1245,8 @@ static int
|
|||||||
wcstrg(void)
|
wcstrg(void)
|
||||||
{
|
{
|
||||||
char *s;
|
char *s;
|
||||||
int c, i, n, wi;
|
int c, n;
|
||||||
|
size_t i, wi;
|
||||||
size_t len, max, wlen;
|
size_t len, max, wlen;
|
||||||
wchar_t *ws;
|
wchar_t *ws;
|
||||||
strg_t *strg;
|
strg_t *strg;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: tree.c,v 1.56 2009/04/13 21:17:37 christos Exp $ */
|
/* $NetBSD: tree.c,v 1.57 2009/04/15 01:20:57 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||||
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#if defined(__RCSID) && !defined(lint)
|
#if defined(__RCSID) && !defined(lint)
|
||||||
__RCSID("$NetBSD: tree.c,v 1.56 2009/04/13 21:17:37 christos Exp $");
|
__RCSID("$NetBSD: tree.c,v 1.57 2009/04/15 01:20:57 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -1010,10 +1010,10 @@ typeok(op_t op, int arg, tnode_t *ln, tnode_t *rn)
|
|||||||
if (!isutyp(rt) && rn->tn_val->v_quad < 0) {
|
if (!isutyp(rt) && rn->tn_val->v_quad < 0) {
|
||||||
/* negative shift */
|
/* negative shift */
|
||||||
warning(121);
|
warning(121);
|
||||||
} else if ((uint64_t)rn->tn_val->v_quad == size(lt)) {
|
} else if ((uint64_t)rn->tn_val->v_quad == (uint64_t)size(lt)) {
|
||||||
/* shift equal to size fo object */
|
/* shift equal to size fo object */
|
||||||
warning(267);
|
warning(267);
|
||||||
} else if ((uint64_t)rn->tn_val->v_quad > size(lt)) {
|
} else if ((uint64_t)rn->tn_val->v_quad > (uint64_t)size(lt)) {
|
||||||
/* shift greater than size of object */
|
/* shift greater than size of object */
|
||||||
warning(122);
|
warning(122);
|
||||||
}
|
}
|
||||||
@ -1546,7 +1546,7 @@ promote(op_t op, int farg, tnode_t *tn)
|
|||||||
{
|
{
|
||||||
tspec_t t;
|
tspec_t t;
|
||||||
type_t *ntp;
|
type_t *ntp;
|
||||||
int len;
|
u_int len;
|
||||||
|
|
||||||
t = tn->tn_type->t_tspec;
|
t = tn->tn_type->t_tspec;
|
||||||
|
|
||||||
@ -2025,7 +2025,7 @@ cvtcon(op_t op, int arg, type_t *tp, val_t *nv, val_t *v)
|
|||||||
nv->v_ldbl = v->v_ldbl;
|
nv->v_ldbl = v->v_ldbl;
|
||||||
} else {
|
} else {
|
||||||
nv->v_quad = (nt == PTR || isutyp(nt)) ?
|
nv->v_quad = (nt == PTR || isutyp(nt)) ?
|
||||||
(uint64_t)v->v_ldbl : (int64_t)v->v_ldbl;
|
(int64_t)v->v_ldbl : (int64_t)v->v_ldbl;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (nt == FLOAT) {
|
if (nt == FLOAT) {
|
||||||
@ -2792,7 +2792,7 @@ fold(tnode_t *tn)
|
|||||||
error(139);
|
error(139);
|
||||||
q = utyp ? UQUAD_MAX : QUAD_MAX;
|
q = utyp ? UQUAD_MAX : QUAD_MAX;
|
||||||
} else {
|
} else {
|
||||||
q = utyp ? ul / ur : sl / sr;
|
q = utyp ? (int64_t)(ul / ur) : sl / sr;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MOD:
|
case MOD:
|
||||||
@ -2801,11 +2801,11 @@ fold(tnode_t *tn)
|
|||||||
error(140);
|
error(140);
|
||||||
q = 0;
|
q = 0;
|
||||||
} else {
|
} else {
|
||||||
q = utyp ? ul % ur : sl % sr;
|
q = utyp ? (int64_t)(ul % ur) : sl % sr;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PLUS:
|
case PLUS:
|
||||||
q = utyp ? ul + ur : sl + sr;
|
q = utyp ? (int64_t)(ul + ur) : sl + sr;
|
||||||
if (msb(sl, t, -1) != 0 && msb(sr, t, -1) != 0) {
|
if (msb(sl, t, -1) != 0 && msb(sr, t, -1) != 0) {
|
||||||
if (msb(q, t, -1) == 0)
|
if (msb(q, t, -1) == 0)
|
||||||
ovfl = 1;
|
ovfl = 1;
|
||||||
@ -2815,7 +2815,7 @@ fold(tnode_t *tn)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MINUS:
|
case MINUS:
|
||||||
q = utyp ? ul - ur : sl - sr;
|
q = utyp ? (int64_t)(ul - ur) : sl - sr;
|
||||||
if (msb(sl, t, -1) != 0 && msb(sr, t, -1) == 0) {
|
if (msb(sl, t, -1) != 0 && msb(sr, t, -1) == 0) {
|
||||||
if (msb(q, t, -1) == 0)
|
if (msb(q, t, -1) == 0)
|
||||||
ovfl = 1;
|
ovfl = 1;
|
||||||
@ -2825,7 +2825,7 @@ fold(tnode_t *tn)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SHL:
|
case SHL:
|
||||||
q = utyp ? ul << sr : sl << sr;
|
q = utyp ? (int64_t)(ul << sr) : sl << sr;
|
||||||
break;
|
break;
|
||||||
case SHR:
|
case SHR:
|
||||||
/*
|
/*
|
||||||
@ -2854,20 +2854,21 @@ fold(tnode_t *tn)
|
|||||||
q = utyp ? ul != ur : sl != sr;
|
q = utyp ? ul != ur : sl != sr;
|
||||||
break;
|
break;
|
||||||
case AND:
|
case AND:
|
||||||
q = utyp ? ul & ur : sl & sr;
|
q = utyp ? (int64_t)(ul & ur) : sl & sr;
|
||||||
break;
|
break;
|
||||||
case XOR:
|
case XOR:
|
||||||
q = utyp ? ul ^ ur : sl ^ sr;
|
q = utyp ? (int64_t)(ul ^ ur) : sl ^ sr;
|
||||||
break;
|
break;
|
||||||
case OR:
|
case OR:
|
||||||
q = utyp ? ul | ur : sl | sr;
|
q = utyp ? (int64_t)(ul | ur) : sl | sr;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LERROR("fold()");
|
LERROR("fold()");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX does not work for quads. */
|
/* XXX does not work for quads. */
|
||||||
if (ovfl || ((q | mask) != ~(uint64_t)0 && (q & ~mask) != 0)) {
|
if (ovfl || ((uint64_t)(q | mask) != ~(uint64_t)0 &&
|
||||||
|
(q & ~mask) != 0)) {
|
||||||
if (hflag)
|
if (hflag)
|
||||||
/* integer overflow detected, op %s */
|
/* integer overflow detected, op %s */
|
||||||
warning(141, modtab[tn->tn_op].m_name);
|
warning(141, modtab[tn->tn_op].m_name);
|
||||||
@ -3743,7 +3744,7 @@ chkaidx(tnode_t *tn, int amper)
|
|||||||
if (!isutyp(rn->tn_type->t_tspec) && con < 0) {
|
if (!isutyp(rn->tn_type->t_tspec) && con < 0) {
|
||||||
/* array subscript cannot be negative: %ld */
|
/* array subscript cannot be negative: %ld */
|
||||||
warning(167, (long)con);
|
warning(167, (long)con);
|
||||||
} else if (dim > 0 && (uint64_t)con >= dim) {
|
} else if (dim > 0 && (uint64_t)con >= (uint64_t)dim) {
|
||||||
/* array subscript cannot be > %d: %ld */
|
/* array subscript cannot be > %d: %ld */
|
||||||
warning(168, dim - 1, (long)con);
|
warning(168, dim - 1, (long)con);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: hash.c,v 1.10 2009/04/14 08:59:45 lukem Exp $ */
|
/* $NetBSD: hash.c,v 1.11 2009/04/15 01:20:57 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||||
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#if defined(__RCSID) && !defined(lint)
|
#if defined(__RCSID) && !defined(lint)
|
||||||
__RCSID("$NetBSD: hash.c,v 1.10 2009/04/14 08:59:45 lukem Exp $");
|
__RCSID("$NetBSD: hash.c,v 1.11 2009/04/15 01:20:57 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -159,7 +159,7 @@ _destroyhash(hte_t **table)
|
|||||||
|
|
||||||
for (i = 0; i < HSHSIZ2; i++) {
|
for (i = 0; i < HSHSIZ2; i++) {
|
||||||
for (hte = table[i]; hte != NULL; hte = nexthte) {
|
for (hte = table[i]; hte != NULL; hte = nexthte) {
|
||||||
free((void *)__UNCONST(hte->h_name));
|
free(__UNCONST(hte->h_name));
|
||||||
nexthte = hte->h_link;
|
nexthte = hte->h_link;
|
||||||
free(hte);
|
free(hte);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: read.c,v 1.24 2009/04/14 09:06:25 lukem Exp $ */
|
/* $NetBSD: read.c,v 1.25 2009/04/15 01:20:57 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
|
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
|
||||||
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#if defined(__RCSID) && !defined(lint)
|
#if defined(__RCSID) && !defined(lint)
|
||||||
__RCSID("$NetBSD: read.c,v 1.24 2009/04/14 09:06:25 lukem Exp $");
|
__RCSID("$NetBSD: read.c,v 1.25 2009/04/15 01:20:57 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -252,10 +252,10 @@ static void
|
|||||||
setfnid(int fid, const char *cp)
|
setfnid(int fid, const char *cp)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (fid == -1)
|
if (fid < 0)
|
||||||
inperr("bad fid");
|
inperr("bad fid");
|
||||||
|
|
||||||
if (fid >= ninpfns) {
|
if ((size_t)fid >= ninpfns) {
|
||||||
inpfns = xrealloc(inpfns, (ninpfns * 2) * sizeof (short));
|
inpfns = xrealloc(inpfns, (ninpfns * 2) * sizeof (short));
|
||||||
(void)memset(inpfns + ninpfns, 0, ninpfns * sizeof (short));
|
(void)memset(inpfns + ninpfns, 0, ninpfns * sizeof (short));
|
||||||
ninpfns *= 2;
|
ninpfns *= 2;
|
||||||
@ -264,7 +264,7 @@ setfnid(int fid, const char *cp)
|
|||||||
* Should always be true because indices written in the output
|
* Should always be true because indices written in the output
|
||||||
* file by lint1 are always the previous index + 1.
|
* file by lint1 are always the previous index + 1.
|
||||||
*/
|
*/
|
||||||
if (fid >= ninpfns)
|
if ((size_t)fid >= ninpfns)
|
||||||
errx(1, "internal error: setfnid()");
|
errx(1, "internal error: setfnid()");
|
||||||
inpfns[fid] = (u_short)getfnidx(cp);
|
inpfns[fid] = (u_short)getfnidx(cp);
|
||||||
}
|
}
|
||||||
@ -1103,7 +1103,7 @@ inpqstrg(const char *src, const char **epp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* keep space for trailing '\0' */
|
/* keep space for trailing '\0' */
|
||||||
if (dst - strg == slen - 1) {
|
if ((size_t)(dst - strg) == slen - 1) {
|
||||||
strg = xrealloc(strg, slen * 2);
|
strg = xrealloc(strg, slen * 2);
|
||||||
dst = strg + (slen - 1);
|
dst = strg + (slen - 1);
|
||||||
slen *= 2;
|
slen *= 2;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: xlint.c,v 1.41 2009/04/14 09:08:39 lukem Exp $ */
|
/* $NetBSD: xlint.c,v 1.42 2009/04/15 01:20:57 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
|
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
|
||||||
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#if defined(__RCSID) && !defined(lint)
|
#if defined(__RCSID) && !defined(lint)
|
||||||
__RCSID("$NetBSD: xlint.c,v 1.41 2009/04/14 09:08:39 lukem Exp $");
|
__RCSID("$NetBSD: xlint.c,v 1.42 2009/04/15 01:20:57 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -310,7 +310,7 @@ int
|
|||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
char flgbuf[3], *tmp, *s;
|
char flgbuf[3], *tmp;
|
||||||
size_t len;
|
size_t len;
|
||||||
const char *ks;
|
const char *ks;
|
||||||
|
|
||||||
@ -319,9 +319,9 @@ main(int argc, char *argv[])
|
|||||||
if ((tmp = getenv("TMPDIR")) == NULL || (len = strlen(tmp)) == 0) {
|
if ((tmp = getenv("TMPDIR")) == NULL || (len = strlen(tmp)) == 0) {
|
||||||
tmpdir = xstrdup(_PATH_TMP);
|
tmpdir = xstrdup(_PATH_TMP);
|
||||||
} else {
|
} else {
|
||||||
s = xmalloc(len + 2);
|
char *p = xmalloc(len + 2);
|
||||||
(void)sprintf(s, "%s%s", tmp, tmp[len - 1] == '/' ? "" : "/");
|
(void)sprintf(p, "%s%s", tmp, tmp[len - 1] == '/' ? "" : "/");
|
||||||
tmpdir = s;
|
tmpdir = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
cppout = xmalloc(strlen(tmpdir) + sizeof ("lint0.XXXXXX"));
|
cppout = xmalloc(strlen(tmpdir) + sizeof ("lint0.XXXXXX"));
|
||||||
@ -645,7 +645,7 @@ fname(const char *name)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ofn = xmalloc(strlen(bn) + (bn == suff ? 4 : 2));
|
ofn = xmalloc(strlen(bn) + (bn == suff ? 4 : 2));
|
||||||
len = bn == suff ? strlen(bn) : (suff - 1) - bn;
|
len = bn == suff ? strlen(bn) : (size_t)((suff - 1) - bn);
|
||||||
(void)sprintf(ofn, "%.*s", (int)len, bn);
|
(void)sprintf(ofn, "%.*s", (int)len, bn);
|
||||||
(void)strcat(ofn, ".ln");
|
(void)strcat(ofn, ".ln");
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user