diff options
author | bouyer <bouyer@pkgsrc.org> | 2004-03-21 00:31:54 +0000 |
---|---|---|
committer | bouyer <bouyer@pkgsrc.org> | 2004-03-21 00:31:54 +0000 |
commit | 2004ee4bbc49b0354b1c3da6716fcd3d9ea67ce4 (patch) | |
tree | 3f26091bb478463c3883f01fca49a992d3813476 /pkgtools | |
parent | f4f117ff6bf682e953e84040c23b3798214981a8 (diff) | |
download | pkgsrc-2004ee4bbc49b0354b1c3da6716fcd3d9ea67ce4.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')
-rw-r--r-- | pkgtools/libnbcompat/files/vis.c | 12 |
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); |