Subject: vis.c and SUNWspro
To: None <tech-pkg@netbsd.org>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: tech-pkg
Date: 03/20/2004 18:34:28
--YiEDa0DAkWCtVeE4
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi,
pkgtools/libnbcompat/files/vis.c has a problem when compiled with Sunpro.
It seems that this compiler emits one char[] per string, even when
an identical string appears in a source file.
As a result, comparing char *o to the "" pointer gives the wrong result
in vis.c, as the "" pointer we're checking against isn't the same as the
"" which initialised char *o.

Attached is a possible (and working) fix, a variant would be to move the
extra char *orig to the macro.
Should I commit it ?

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--

--YiEDa0DAkWCtVeE4
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="vis.c.diff"

--- ../../../pkgtools/libnbcompat/files/vis.c	Tue Mar 16 22:55:22 2004
+++ vis.c	Sat Mar 20 18:26:49 2004
@@ -318,11 +318,12 @@
 	int c, flag, nextc;
 	
 {
+	const char *orig = "";
 	char *extra;
 
 	_DIAGASSERT(dst != NULL);
 
-	MAKEEXTRALIST(flag, extra, "");
+	MAKEEXTRALIST(flag, extra, orig);
 	if (flag & VIS_HTTPSTYLE)
 	    HVIS(dst, c, flag, nextc, extra);
 	else
@@ -349,10 +350,11 @@
 	const char *src;
 	int flag;
 {
+	const char *orig = "";
 	char *extra;
 	int ret;
 
-	MAKEEXTRALIST(flag, extra, "");
+	MAKEEXTRALIST(flag, extra, orig);
 	ret = strsvis(dst, src, flag, extra);
 	free(extra);
 	return(ret);
@@ -366,10 +368,11 @@
 	size_t len;
 	int flag;
 {
+	const char *orig = "";
 	char *extra;
 	int ret;
 
-	MAKEEXTRALIST(flag, extra, "");
+	MAKEEXTRALIST(flag, extra, orig);
 	ret = strsvisx(dst, src, len, flag, extra);
 	free(extra);
 	return(ret);

--YiEDa0DAkWCtVeE4--