summaryrefslogtreecommitdiff
path: root/pkgtools/libnbcompat
diff options
context:
space:
mode:
authorbouyer <bouyer@pkgsrc.org>2004-03-21 00:31:54 +0000
committerbouyer <bouyer@pkgsrc.org>2004-03-21 00:31:54 +0000
commitd5416af48d2e836398fd01f616f5c16d8802ab86 (patch)
tree3f26091bb478463c3883f01fca49a992d3813476 /pkgtools/libnbcompat
parent60fe9a9234ac432aaa59bd43486a47128545df7c (diff)
downloadpkgsrc-d5416af48d2e836398fd01f616f5c16d8802ab86.tar.gz
Some compilers (e.g. Sunpro) emit one char[] per string, even when
multiple identical strings appear 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. Use a global pointer initialised to "", and use it for MAKEEXTRALIST() calls. Thanks to Christos Zoulas for suggesting the right solution :)
Diffstat (limited to 'pkgtools/libnbcompat')
-rw-r--r--pkgtools/libnbcompat/files/vis.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/pkgtools/libnbcompat/files/vis.c b/pkgtools/libnbcompat/files/vis.c
index b07045cc282..8dd02909c97 100644
--- a/pkgtools/libnbcompat/files/vis.c
+++ b/pkgtools/libnbcompat/files/vis.c
@@ -1,4 +1,4 @@
-/* $NetBSD: vis.c,v 1.4 2004/03/12 15:21:13 grant Exp $ */
+/* $NetBSD: vis.c,v 1.5 2004/03/21 00:31:54 bouyer Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
#endif
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: vis.c,v 1.4 2004/03/12 15:21:13 grant Exp $");
+__RCSID("$NetBSD: vis.c,v 1.5 2004/03/21 00:31:54 bouyer Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@@ -90,6 +90,8 @@ __weak_alias(vis,_vis)
#define BELL '\007'
#endif
+static const char empty[] = "";
+
#define isoctal(c) (((u_char)(c)) >= '0' && ((u_char)(c)) <= '7')
#define iswhite(c) (c == ' ' || c == '\t' || c == '\n')
#define issafe(c) (c == '\b' || c == BELL || c == '\r')
@@ -322,7 +324,7 @@ vis(dst, c, flag, nextc)
_DIAGASSERT(dst != NULL);
- MAKEEXTRALIST(flag, extra, "");
+ MAKEEXTRALIST(flag, extra, empty);
if (flag & VIS_HTTPSTYLE)
HVIS(dst, c, flag, nextc, extra);
else
@@ -352,7 +354,7 @@ strvis(dst, src, flag)
char *extra;
int ret;
- MAKEEXTRALIST(flag, extra, "");
+ MAKEEXTRALIST(flag, extra, empty);
ret = strsvis(dst, src, flag, extra);
free(extra);
return(ret);
@@ -369,7 +371,7 @@ strvisx(dst, src, len, flag)
char *extra;
int ret;
- MAKEEXTRALIST(flag, extra, "");
+ MAKEEXTRALIST(flag, extra, empty);
ret = strsvisx(dst, src, len, flag, extra);
free(extra);
return(ret);