From dan@obluda.cz  Mon Jun 24 19:05:44 2002
Return-Path: <dan@obluda.cz>
Received: from xkulesh.vol.cz (xkulesh.vol.cz [195.250.154.106])
	by hub.freebsd.org (Postfix) with ESMTP id 6819D37B403
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 24 Jun 2002 19:05:39 -0700 (PDT)
Received: from obluda.cz (localhost [127.0.0.1])
	by xkulesh.vol.cz (8.12.3/8.12.3) with ESMTP id g5P25aU1054187
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 25 Jun 2002 04:05:37 +0200 (CEST)
	(envelope-from dan@obluda.cz)
Received: (from root@localhost)
	by xkulesh.vol.cz (8.12.4/8.12.4/Submit) id g5P0di0U052472;
	Tue, 25 Jun 2002 02:39:45 +0200 (CEST)
Message-Id: <200206250039.g5P0di0U052472@xkulesh.vol.cz>
Date: Tue, 25 Jun 2002 02:39:45 +0200 (CEST)
From: Dan Lukes <dan@obluda.cz>
Reply-To: Dan Lukes <dan@obluda.cz>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: cleaning bin/sh code from warnings
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         39819
>Category:       bin
>Synopsis:       cleaning bin/sh code from warnings
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jun 24 19:10:03 PDT 2002
>Closed-Date:    Thu Sep 08 18:11:16 GMT 2005
>Last-Modified:  Thu Sep 08 18:11:16 GMT 2005
>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:
Responsible-Changed-From-To: freebsd-bugs->tjr 
Responsible-Changed-By: tjr 
Responsible-Changed-When: Wed Jul 10 18:16:35 PDT 2002 
Responsible-Changed-Why:  
I'll take this one. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=39819 
Responsible-Changed-From-To: tjr->freebsd-bugs 
Responsible-Changed-By: tjr 
Responsible-Changed-When: Sat Feb 14 23:37:40 PST 2004 
Responsible-Changed-Why:  
Unassign due to lack of time and interest. Perhaps someone else 
will pick this up. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=39819 
State-Changed-From-To: open->closed 
State-Changed-By: stefanf 
State-Changed-When: Thu Sep 8 18:07:39 GMT 2005 
State-Changed-Why:  
The changes to memalloc.{c,h} are no longer needed because printf isn't a 
builtin anymore, your second patch was committed in var.c's 1.17.  Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=39819 
>Unformatted:
