Date: Tue, 25 Jun 2002 02:39:45 +0200 (CEST) From: Dan Lukes <dan@obluda.cz> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/39819: cleaning bin/sh code from warnings Message-ID: <200206250039.g5P0di0U052472@xkulesh.vol.cz>
next in thread | raw e-mail | index | archive | help
>Number: 39819
>Category: bin
>Synopsis: cleaning bin/sh code from warnings
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Mon Jun 24 19:10:03 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Dan Lukes
>Release: FreeBSD 4.6-STABLE i386
>Organization:
Obludarium
>Environment:
System: FreeBSD xkulesh.vol.cz 4.6-STABLE FreeBSD
bin/sh/memalloc.h,v 1.6.2.1 2000/09/06 08:38:45
bin/sh/memalloc.c,v 1.15.2.1 2000/09/06 08:38:45
bin/sh/var.c,v 1.15 1999/08/27 23:15:26
>Description:
I want to clean some warnings from code.
bin/sh/../../usr.bin/printf/printf.c:223:
warning: passing arg 1 of `savestr' discards qualifiers from pointer target type
It is caused by missing 'const' qualifier from savestr declaration.
savestr(s) call scopy(s,r), the scopy is defined as strcpy(r,s)
s is (const char *) in strcpy, savestr doesn't modify the s anyway, so it can
be declared as (const char *)
========
bin/sh/var.c: In function `setvareq':312:
warning: field width is not type int (arg 2)
'len' variable is declared as size_t (e.g. unsigned int), but used on the place
where int is allowed only
>How-To-Repeat:
N/A
>Fix:
--- bin/sh/memalloc.h.ORIG Tue Oct 3 04:43:15 2000
+++ bin/sh/memalloc.h Mon Jun 24 22:03:04 2002
@@ -52,7 +52,7 @@
pointer ckmalloc __P((int));
pointer ckrealloc __P((pointer, int));
-char *savestr __P((char *));
+char *savestr __P((const char *));
pointer stalloc __P((int));
void stunalloc __P((pointer));
void setstackmark __P((struct stackmark *));
--- bin/sh/memalloc.c.ORIG Tue Oct 3 04:43:15 2000
+++ bin/sh/memalloc.c Mon Jun 24 22:02:21 2002
@@ -89,7 +89,7 @@
char *
savestr(s)
- char *s;
+ const char *s;
{
char *p;
--- bin/sh/var.c.ORIG Sat Aug 28 01:15:26 1999
+++ bin/sh/var.c Mon Jun 24 22:44:08 2002
@@ -308,7 +308,7 @@
for (vp = *vpp ; vp ; vp = vp->next) {
if (varequal(s, vp->text)) {
if (vp->flags & VREADONLY) {
- size_t len = strchr(s, '=') - s;
+ int len = strchr(s, '=') - s;
error("%.*s: is read only", len, s);
}
INTOFF;
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200206250039.g5P0di0U052472>
