public inbox for libc-locales@sourceware.org
 help / color / mirror / Atom feed
* [RFC][PATCH] Locale convenience funtions
@ 2013-06-17  2:24 Seung-yeon Choe
  2013-06-17  4:53 ` Ondřej Bílka
  0 siblings, 1 reply; 2+ messages in thread
From: Seung-yeon Choe @ 2013-06-17  2:24 UTC (permalink / raw)
  To: libc-alpha, libc-locales

Dear, glibc locale maintainers.
 
I'd like to discuss about additional functions for locale convenience which are supported by the other libc library (eg. bsd libc library).
For example, to support a snprintf_l convenience funciton, I think we can write an implemantation as the following patch set.
And likewise the other functions too. (asprintf_l, fprintf_l, printf_l, sprintf_l, vasprintf_l, vfprintf_l, vprintf_l, vsnprintf_l, vsprintf_l)
Please let me know whether this approach is acceptable or not.
 
Regards,
Seung-yeon Choe.
s.choe@samsung.com

diff -Naur glibc-2.17/libio/stdio.h glibc-2.17_snprintf/libio/stdio.h
--- glibc-2.17/libio/stdio.h    2012-12-25 12:02:13.000000000 +0900
+++ glibc-2.17_snprintf/libio/stdio.h   2013-06-10 17:23:49.021522380 +0900
@@ -416,6 +416,12 @@
      __attribute__ ((__format__ (__printf__, 2, 3)));
 #endif
+#ifdef __USE_GNU
+/* Locale convenience functions */
+extern int snprintf_l (char *__restrict __s, size_t __maxlen, locale_t loc,
+                     const char *__restrict __format, ...)
+     __THROWNL __attribute__ ((__format__ (__printf__, 4, 5)));
+#endif
 __BEGIN_NAMESPACE_STD
 /* Read formatted input from STREAM.
diff -Naur glibc-2.17/stdio-common/snprintf_l.c glibc-2.17_snprintf/stdio-common/snprintf_l.c
--- glibc-2.17/stdio-common/snprintf_l.c        1970-01-01 09:00:00.000000000 +0900
+++ glibc-2.17_snprintf/stdio-common/snprintf_l.c       2013-06-10 17:21:43.049522395 +0900
@@ -0,0 +1,40 @@
+#include <stdarg.h>
+#include <stdio.h>
+#include <xlocale.h>
+
+int
+__snprintf_l (char *s, size_t maxlen, locale_t loc, const char *format, ...)
+{
+  va_list arg;
+  int done;
+  locale_t old_loc = uselocale (loc);
+
+  va_start (arg, format);
+  done = __vsnprintf (s, maxlen, format, arg);
+  va_end (arg);
+
+  uselocale (old_loc);
+  return done;
+}
+ldbl_weak_alias (__snprintf_l, snprintf_l)


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [RFC][PATCH] Locale convenience funtions
  2013-06-17  2:24 [RFC][PATCH] Locale convenience funtions Seung-yeon Choe
@ 2013-06-17  4:53 ` Ondřej Bílka
  0 siblings, 0 replies; 2+ messages in thread
From: Ondřej Bílka @ 2013-06-17  4:53 UTC (permalink / raw)
  To: Seung-yeon Choe; +Cc: libc-alpha, libc-locales

On Mon, Jun 17, 2013 at 02:23:08AM +0000, Seung-yeon Choe wrote:
> Dear, glibc locale maintainers.
>  
> I'd like to discuss about additional functions for locale convenience which are supported by the other libc library (eg. bsd libc library).
> For example, to support a snprintf_l convenience funciton, I think we can write an implemantation as the following patch set.
> And likewise the other functions too. (asprintf_l, fprintf_l, printf_l, sprintf_l, vasprintf_l, vfprintf_l, vprintf_l, vsnprintf_l, vsprintf_l)
> Please let me know whether this approach is acceptable or not.
>  
Hi,

As we are close to 2.18 freeze it will take month before this patch
becomes relevant again.

Does your company have copyrigth assignment? This takes some time to
process so it is better to handle it first than having patch waiting
only for assignment.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-17  4:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-17  2:24 [RFC][PATCH] Locale convenience funtions Seung-yeon Choe
2013-06-17  4:53 ` Ondřej Bílka

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 read-only IMAP folder(s) and NNTP newsgroup(s).