Module Name:    src
Committed By:   joerg
Date:           Fri Apr 19 23:28:47 UTC 2013

Modified Files:
        src/include: string.h
        src/lib/libc/include: namespace.h
        src/lib/libc/string: strcoll.c strxfrm.c

Log Message:
Add dummy strcoll_l and strxfrm_l.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/include/string.h
cvs rdiff -u -r1.162 -r1.163 src/lib/libc/include/namespace.h
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/string/strcoll.c
cvs rdiff -u -r1.12 -r1.13 src/lib/libc/string/strxfrm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/include/string.h
diff -u src/include/string.h:1.41 src/include/string.h:1.42
--- src/include/string.h:1.41	Thu Aug 30 12:16:48 2012
+++ src/include/string.h	Fri Apr 19 23:28:47 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: string.h,v 1.41 2012/08/30 12:16:48 drochner Exp $	*/
+/*	$NetBSD: string.h,v 1.42 2013/04/19 23:28:47 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -114,6 +114,15 @@ int	__consttime_bcmp(const void *, const
 __END_DECLS
 #endif
 
+#if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)
+#  ifndef __LOCALE_T_DECLARED
+typedef struct _locale		*locale_t;
+#  define __LOCALE_T_DECLARED
+#  endif
+int	 strcoll_l(const char *, const char *, locale_t);
+size_t	 strxfrm_l(char * __restrict, const char * __restrict, size_t, locale_t);
+#endif /* _POSIX_C_SOURCE || _NETBSD_SOURCE */
+
 #if _FORTIFY_SOURCE > 0
 #include <ssp/string.h>
 #endif

Index: src/lib/libc/include/namespace.h
diff -u src/lib/libc/include/namespace.h:1.162 src/lib/libc/include/namespace.h:1.163
--- src/lib/libc/include/namespace.h:1.162	Fri Apr 19 15:22:24 2013
+++ src/lib/libc/include/namespace.h	Fri Apr 19 23:28:47 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: namespace.h,v 1.162 2013/04/19 15:22:24 joerg Exp $	*/
+/*	$NetBSD: namespace.h,v 1.163 2013/04/19 23:28:47 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
@@ -606,6 +606,7 @@
 #define srandom			_srandom
 #define statvfs(a, b)		_statvfs(a, b)
 #define strcasecmp		_strcasecmp
+#define strcoll_l		_strcoll_l
 #define strdup			_strdup
 #define stresep			_stresep
 #define strftime_z		_strftime_z
@@ -619,6 +620,7 @@
 #define strtok_r		_strtok_r
 #define strnunvisx		_strnunvisx
 #define strvisx			_strvisx
+#define strxfrm_l		_strxfrm_l
 #define svc_auth_reg		_svc_auth_reg
 #define svc_create		_svc_create
 #define svc_dg_create		_svc_dg_create

Index: src/lib/libc/string/strcoll.c
diff -u src/lib/libc/string/strcoll.c:1.10 src/lib/libc/string/strcoll.c:1.11
--- src/lib/libc/string/strcoll.c:1.10	Mon Jun 25 22:32:46 2012
+++ src/lib/libc/string/strcoll.c	Fri Apr 19 23:28:47 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: strcoll.c,v 1.10 2012/06/25 22:32:46 abs Exp $	*/
+/*	$NetBSD: strcoll.c,v 1.11 2013/04/19 23:28:47 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,12 +37,18 @@
 #if 0
 static char sccsid[] = "@(#)strcoll.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: strcoll.c,v 1.10 2012/06/25 22:32:46 abs Exp $");
+__RCSID("$NetBSD: strcoll.c,v 1.11 2013/04/19 23:28:47 joerg Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
+#include "namespace.h"
+
 #include <assert.h>
+#include <locale.h>
 #include <string.h>
+#include "setlocale_local.h"
+
+__weak_alias(strcoll_l, _strcoll_l)
 
 /*
  * Compare strings according to LC_COLLATE category of current locale.
@@ -51,9 +57,19 @@ int
 strcoll(const char *s1, const char *s2)
 {
 
+	return strcoll_l(s1, s2, *_current_locale());
+}
+
+int
+strcoll_l(const char *s1, const char *s2, locale_t loc)
+{
 	_DIAGASSERT(s1 != NULL);
 	_DIAGASSERT(s2 != NULL);
 
+	if (loc == NULL)
+		loc = _C_locale;
+
 	/* LC_COLLATE is unimplemented, hence always "C" */
+	/* LINTED */ (void)loc;
 	return (strcmp(s1, s2));
 }

Index: src/lib/libc/string/strxfrm.c
diff -u src/lib/libc/string/strxfrm.c:1.12 src/lib/libc/string/strxfrm.c:1.13
--- src/lib/libc/string/strxfrm.c:1.12	Mon Jun 25 22:32:46 2012
+++ src/lib/libc/string/strxfrm.c	Fri Apr 19 23:28:47 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: strxfrm.c,v 1.12 2012/06/25 22:32:46 abs Exp $	*/
+/*	$NetBSD: strxfrm.c,v 1.13 2013/04/19 23:28:47 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,12 +37,18 @@
 #if 0
 static char sccsid[] = "@(#)strxfrm.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: strxfrm.c,v 1.12 2012/06/25 22:32:46 abs Exp $");
+__RCSID("$NetBSD: strxfrm.c,v 1.13 2013/04/19 23:28:47 joerg Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
+#include "namespace.h"
+
 #include <assert.h>
+#include <locale.h>
 #include <string.h>
+#include "setlocale_local.h"
+
+__weak_alias(strxfrm_l, _strxfrm_l)
 
 /*
  * Transform src, storing the result in dst, such that
@@ -50,12 +56,17 @@ __RCSID("$NetBSD: strxfrm.c,v 1.12 2012/
  * on the original untransformed strings would return.
  */
 size_t
-strxfrm(char *dst, const char *src, size_t n)
+strxfrm_l(char *dst, const char *src, size_t n, locale_t loc)
 {
 	size_t srclen, copysize;
 
 	_DIAGASSERT(src != NULL);
 
+	if (loc == NULL)
+		loc = _C_locale;
+	/* XXX: LC_COLLATE should be implemented. */
+	/* LINTED */(void)loc;
+
 	/*
 	 * Since locales are unimplemented, this is just a copy.
 	 */
@@ -68,3 +79,9 @@ strxfrm(char *dst, const char *src, size
 	}
 	return (srclen);
 }
+
+size_t
+strxfrm(char *dst, const char *src, size_t n)
+{
+	return strxfrm_l(dst, src, n, *_current_locale());
+}

Reply via email to