Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/gen get rid of MB_STRZ as suggested by joerg.
details: https://anonhg.NetBSD.org/src/rev/96008e295a3b
branches: trunk
changeset: 332138:96008e295a3b
user: christos <christos%NetBSD.org@localhost>
date: Mon Sep 08 17:35:01 2014 +0000
description:
get rid of MB_STRZ as suggested by joerg.
diffstat:
lib/libc/gen/vis.c | 24 +++++++++++++++---------
1 files changed, 15 insertions(+), 9 deletions(-)
diffs (83 lines):
diff -r 49ce212e4c93 -r 96008e295a3b lib/libc/gen/vis.c
--- a/lib/libc/gen/vis.c Mon Sep 08 16:42:09 2014 +0000
+++ b/lib/libc/gen/vis.c Mon Sep 08 17:35:01 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vis.c,v 1.61 2014/09/08 16:42:09 christos Exp $ */
+/* $NetBSD: vis.c,v 1.62 2014/09/08 17:35:01 christos Exp $ */
/*-
* Copyright (c) 1989, 1993
@@ -57,7 +57,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: vis.c,v 1.61 2014/09/08 16:42:09 christos Exp $");
+__RCSID("$NetBSD: vis.c,v 1.62 2014/09/08 17:35:01 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#ifdef __FBSDID
__FBSDID("$FreeBSD$");
@@ -105,7 +105,6 @@
#define XTOA(c) L"0123456789ABCDEF"[c]
#define MAXEXTRAS 10
-#define MB_STRZ ((size_t)-1)
#if !HAVE_NBTOOL_CONFIG_H
#ifndef __NetBSD__
@@ -376,8 +375,6 @@
/* Allocate space for the wide char strings */
psrc = pdst = extra = NULL;
- if (mblength == MB_STRZ)
- mblength = strlen(mbsrc);
if ((psrc = calloc(mblength + 1, sizeof(*psrc))) == NULL)
return -1;
if ((pdst = calloc((4 * mblength) + 1, sizeof(*pdst))) == NULL)
@@ -529,6 +526,15 @@
free(psrc);
return error;
}
+
+static int
+istrsenvisxl(char *mbdst, size_t *dlen, const char *mbsrc,
+ int flags, const char *mbextra, int *cerr_ptr)
+{
+ return istrsenvisx(mbdst, dlen, mbsrc,
+ mbsrc != NULL ? strlen(mbsrc) : 0, flags, mbextra, cerr_ptr);
+}
+
#endif
#if !HAVE_SVIS
@@ -572,13 +578,13 @@
int
strsvis(char *mbdst, const char *mbsrc, int flags, const char *mbextra)
{
- return istrsenvisx(mbdst, NULL, mbsrc, MB_STRZ, flags, mbextra, NULL);
+ return istrsenvisxl(mbdst, NULL, mbsrc, flags, mbextra, NULL);
}
int
strsnvis(char *mbdst, size_t dlen, const char *mbsrc, int flags, const char *mbextra)
{
- return istrsenvisx(mbdst, &dlen, mbsrc, MB_STRZ, flags, mbextra, NULL);
+ return istrsenvisxl(mbdst, &dlen, mbsrc, flags, mbextra, NULL);
}
int
@@ -647,13 +653,13 @@
int
strvis(char *mbdst, const char *mbsrc, int flags)
{
- return istrsenvisx(mbdst, NULL, mbsrc, MB_STRZ, flags, "", NULL);
+ return istrsenvisxl(mbdst, NULL, mbsrc, flags, "", NULL);
}
int
strnvis(char *mbdst, size_t dlen, const char *mbsrc, int flags)
{
- return istrsenvisx(mbdst, &dlen, mbsrc, MB_STRZ, flags, "", NULL);
+ return istrsenvisxl(mbdst, &dlen, mbsrc, flags, "", NULL);
}
/*
Home |
Main Index |
Thread Index |
Old Index