mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Isaac Dunham <idunham@lavabit.com>
To: musl@lists.openwall.com
Subject: Re: [PATCH 6/10] Provide private versions of locale/ functions
Date: Sun, 22 Jul 2012 18:32:01 -0700	[thread overview]
Message-ID: <20120722183201.11fe567e@newbook> (raw)
In-Reply-To: <20120722181332.191d4fa5@newbook>

[-- Attachment #1: Type: text/plain, Size: 551 bytes --]

On Sun, 22 Jul 2012 18:13:32 -0700
Isaac Dunham <idunham@lavabit.com> wrote:

> This patch series is basically a reworked version of orc's previous
> patch.
> From what orc said, the first patch should provide enough to build
> Xorg; I haven't tested this yet.
> A few more patches are syscall wrappers (splice) or trivial
> functions (finite).
> Finally, there are several aliases.

This renames several functions in locale/ to __*, and weak-aliases to
the original names.
Mainly useful if they ever do get dragged into the ISO code...

Isaac Dunham

[-- Attachment #2: 6-__locale.diff --]
[-- Type: text/x-patch, Size: 5899 bytes --]

diff --git a/src/locale/duplocale.c b/src/locale/duplocale.c
index 5f01e13..716df4a 100644
--- a/src/locale/duplocale.c
+++ b/src/locale/duplocale.c
@@ -1,11 +1,14 @@
 #include <stdlib.h>
 #include <string.h>
 #include "locale_impl.h"
+#include "libc.h"
 
-locale_t duplocale(locale_t old)
+locale_t __duplocale(locale_t old)
 {
 	locale_t new;
 	new = calloc(1, sizeof *new);
 	if (new && old != LC_GLOBAL_LOCALE) memcpy(new, old, sizeof *new);
 	return new;
 }
+
+weak_alias(__duplocale, duplocale);
diff --git a/src/locale/freelocale.c b/src/locale/freelocale.c
index 4e089f2..f35ac46 100644
--- a/src/locale/freelocale.c
+++ b/src/locale/freelocale.c
@@ -1,7 +1,10 @@
 #include <stdlib.h>
 #include "locale_impl.h"
+#include "libc.h"
 
-void freelocale(locale_t l)
+void __freelocale(locale_t l)
 {
 	free(l);
 }
+
+weak_alias(__freelocale, freelocale);
diff --git a/src/locale/iswctype_l.c b/src/locale/iswctype_l.c
index 1dccef6..c20ef6a 100644
--- a/src/locale/iswctype_l.c
+++ b/src/locale/iswctype_l.c
@@ -1,6 +1,9 @@
 #include <wctype.h>
+#include "libc.h"
 
-int iswctype_l(wint_t c, wctype_t t, locale_t l)
+int __iswctype_l(wint_t c, wctype_t t, locale_t l)
 {
 	return iswctype(c, t);
 }
+
+weak_alias(__iswctype_l, iswctype_l);
diff --git a/src/locale/newlocale.c b/src/locale/newlocale.c
index 986e796..447c8fc 100644
--- a/src/locale/newlocale.c
+++ b/src/locale/newlocale.c
@@ -1,6 +1,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "locale_impl.h"
+#include "libc.h"
 
 locale_t newlocale(int mask, const char *name, locale_t base)
 {
@@ -9,3 +10,5 @@ locale_t newlocale(int mask, const char *name, locale_t base)
 	if (!base) base = calloc(1, sizeof *base);
 	return base;
 }
+
+weak_alias(newlocale, __newlocale);
diff --git a/src/locale/nl_langinfo_l.c b/src/locale/nl_langinfo_l.c
index b54db95..3227d63 100644
--- a/src/locale/nl_langinfo_l.c
+++ b/src/locale/nl_langinfo_l.c
@@ -1,7 +1,10 @@
 #include <locale.h>
 #include <langinfo.h>
+#include "libc.h"
 
-char *nl_langinfo_l(nl_item item, locale_t l)
+char *__nl_langinfo_l(nl_item item, locale_t l)
 {
 	return nl_langinfo(item);
 }
+
+weak_alias(__nl_langinfo_l, nl_langinfo_l);
diff --git a/src/locale/strcoll_l.c b/src/locale/strcoll_l.c
index 7948b0d..2b096db 100644
--- a/src/locale/strcoll_l.c
+++ b/src/locale/strcoll_l.c
@@ -1,7 +1,10 @@
 #include <string.h>
 #include <locale.h>
+#include "libc.h"
 
-int strcoll_l(const char *l, const char *r, locale_t loc)
+int __strcoll_l(const char *l, const char *r, locale_t loc)
 {
 	return strcoll(l, r);
 }
+
+weak_alias(__strcoll_l, strcoll_l);
diff --git a/src/locale/strftime_l.c b/src/locale/strftime_l.c
index 70b2f15..edda89d 100644
--- a/src/locale/strftime_l.c
+++ b/src/locale/strftime_l.c
@@ -1,7 +1,10 @@
 #include <locale.h>
 #include <time.h>
+#include "libc.h"
 
-size_t strftime_l(char *s, size_t n, const char *f, const struct tm *tm, locale_t l)
+size_t __strftime_l(char *s, size_t n, const char *f, const struct tm *tm, locale_t l)
 {
 	return strftime(s, n, f, tm);
 }
+
+weak_alias(__strftime_l, strftime_l);
diff --git a/src/locale/strxfrm_l.c b/src/locale/strxfrm_l.c
index 78e5655..788c350 100644
--- a/src/locale/strxfrm_l.c
+++ b/src/locale/strxfrm_l.c
@@ -1,6 +1,9 @@
 #include <string.h>
+#include "libc.h"
 
-size_t strxfrm_l(char *dest, const char *src, size_t n, locale_t l)
+size_t __strxfrm_l(char *dest, const char *src, size_t n, locale_t l)
 {
 	return strxfrm(dest, src, n);
 }
+
+weak_alias(__strxfrm_l, strxfrm_l);
diff --git a/src/locale/towlower_l.c b/src/locale/towlower_l.c
index 05fcde5..d565316 100644
--- a/src/locale/towlower_l.c
+++ b/src/locale/towlower_l.c
@@ -1,6 +1,9 @@
 #include <wctype.h>
+#include "libc.h"
 
-wint_t towlower_l(wint_t c, locale_t l)
+wint_t __towlower_l(wint_t c, locale_t l)
 {
 	return towlower(c);
 }
+
+weak_alias(__towlower_l, towlower_l);
diff --git a/src/locale/towupper_l.c b/src/locale/towupper_l.c
index aa861ae..f843c4f 100644
--- a/src/locale/towupper_l.c
+++ b/src/locale/towupper_l.c
@@ -1,6 +1,9 @@
 #include <wctype.h>
+#include "libc.h"
 
-wint_t towupper_l(wint_t c, locale_t l)
+wint_t __towupper_l(wint_t c, locale_t l)
 {
 	return towupper(c);
 }
+
+weak_alias(__towupper_l, towupper_l);
diff --git a/src/locale/uselocale.c b/src/locale/uselocale.c
index 9c79957..a1405c5 100644
--- a/src/locale/uselocale.c
+++ b/src/locale/uselocale.c
@@ -1,10 +1,13 @@
 #include "locale_impl.h"
 #include "pthread_impl.h"
+#include "libc.h"
 
-locale_t uselocale(locale_t l)
+locale_t __uselocale(locale_t l)
 {
 	pthread_t self = pthread_self();
 	locale_t old = self->locale;
 	if (l) self->locale = l;
 	return old;
 }
+
+weak_alias(__uselocale, uselocale);
diff --git a/src/locale/wcscoll_l.c b/src/locale/wcscoll_l.c
index f257ec8..bf26372 100644
--- a/src/locale/wcscoll_l.c
+++ b/src/locale/wcscoll_l.c
@@ -1,6 +1,9 @@
 #include <wchar.h>
+#include "libc.h"
 
-int wcscoll_l(const wchar_t *l, const wchar_t *r, locale_t locale)
+int __wcscoll_l(const wchar_t *l, const wchar_t *r, locale_t locale)
 {
 	return wcscoll(l, r);
 }
+
+weak_alias(__wcscoll_l, wcscoll_l);
diff --git a/src/locale/wcsxfrm_l.c b/src/locale/wcsxfrm_l.c
index 831998e..4f47587 100644
--- a/src/locale/wcsxfrm_l.c
+++ b/src/locale/wcsxfrm_l.c
@@ -1,6 +1,9 @@
 #include <wchar.h>
+#include "libc.h"
 
-size_t wcsxfrm_l(wchar_t *dest, const wchar_t *src, size_t n, locale_t locale)
+size_t __wcsxfrm_l(wchar_t *dest, const wchar_t *src, size_t n, locale_t locale)
 {
 	return wcsxfrm(dest, src, n);
 }
+
+weak_alias(__wcsxfrm_l, wcsxfrm_l);
diff --git a/src/locale/wctype_l.c b/src/locale/wctype_l.c
index 01f9c67..d937275 100644
--- a/src/locale/wctype_l.c
+++ b/src/locale/wctype_l.c
@@ -1,6 +1,9 @@
 #include <wctype.h>
+#include "libc.h"
 
-wctype_t wctype_l(const char *s, locale_t l)
+wctype_t __wctype_l(const char *s, locale_t l)
 {
 	return wctype(s);
 }
+
+weak_alias(__wctype_l, wctype_l);

  parent reply	other threads:[~2012-07-23  1:32 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-23  1:13 [PATCH 1/10] ioperm & iopl Isaac Dunham
2012-07-23  1:17 ` [PATCH 2/10] splice Isaac Dunham
2012-07-23  1:21 ` [PATCH 3/10] xattr syscalls Isaac Dunham
2012-07-24 18:06   ` orc
2012-07-23  1:24 ` [PATCH 4/10] pipe2 Isaac Dunham
2012-07-23  1:28 ` [PATCH 5/10] __sigsetjmp alias Isaac Dunham
2012-07-23  1:32 ` Isaac Dunham [this message]
2012-07-23  1:33 ` [PATCH 7/10] __fcntl Isaac Dunham
2012-07-23  1:36 ` [PATCH 8/10] finite Isaac Dunham
2012-07-23  7:58   ` Szabolcs Nagy
2012-07-23  1:38 ` [PATCH 9/10] GLIBC ABI patches Isaac Dunham
2012-07-23 15:11   ` Arvid E. Picciani
2012-07-24 18:15     ` Igmar Palsenberg
2012-07-24 18:19       ` Gregor Richards
2012-07-24 18:23         ` Igmar Palsenberg
2012-07-24 18:29           ` Gregor Richards
2012-07-24 18:33             ` Igmar Palsenberg
2012-07-24 23:18               ` Rich Felker
2012-07-25  7:27               ` Arvid E. Picciani
2012-07-25 14:12   ` Luca Barbato
2012-07-25 15:19     ` Rich Felker
2012-07-25 15:52       ` Luca Barbato
2012-07-25 17:35         ` Rich Felker
2012-07-25 23:06       ` idunham
2012-07-23  1:40 ` [PATCH 10/10] More glibc ABI compatability Isaac Dunham
2012-08-07  2:22 ` [PATCH 1/10] ioperm & iopl Isaac Dunham
2012-08-07  3:29   ` Isaac Dunham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120722183201.11fe567e@newbook \
    --to=idunham@lavabit.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).