pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/libnbcompat/files Some compilers (e.g. Sunpro...
details: https://anonhg.NetBSD.org/pkgsrc/rev/bacf6f57628f
branches: trunk
changeset: 471191:bacf6f57628f
user: bouyer <bouyer%pkgsrc.org@localhost>
date: Sun Mar 21 00:31:54 2004 +0000
description:
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:
pkgtools/libnbcompat/files/vis.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diffs (54 lines):
diff -r 5fe77256bfa7 -r bacf6f57628f pkgtools/libnbcompat/files/vis.c
--- a/pkgtools/libnbcompat/files/vis.c Sun Mar 21 00:08:18 2004 +0000
+++ b/pkgtools/libnbcompat/files/vis.c Sun Mar 21 00:31:54 2004 +0000
@@ -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 @@
#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 @@
_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 @@
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 @@
char *extra;
int ret;
- MAKEEXTRALIST(flag, extra, "");
+ MAKEEXTRALIST(flag, extra, empty);
ret = strsvisx(dst, src, len, flag, extra);
free(extra);
return(ret);
Home |
Main Index |
Thread Index |
Old Index