[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Patches] Fix argp for use in glibc_localedef
- To: patches@xxxxxxxxxx
- Subject: [Patches] Fix argp for use in glibc_localedef
- From: "Joseph S. Myers" <joseph@xxxxxxxxxxxxxxxx>
- Date: Wed, 26 Oct 2011 18:54:02 +0000 (UTC)
glibc_localedef uses argp code outside of libc, which can run into
problems where that code uses glibc-internal interfaces. Previously such
use of internal interfaces was conditioned on USE_IN_LIBIO, but
USE_IN_LIBIO conditions were recently removed; I've applied this patch to
restore such conditional, but now checking _LIBC.
(Ideally - in a world where localedef is designed and implemented as a
self-contained portable program not heavily tied into glibc, with a fully
self-contained build system used for both native and cross cases rather
than needing to reach over into C library sources - the way to make these
interfaces available for localedef code would be to use the gnulib version
of argp. In general I think the glibc build could do with being split up
into more pieces, less tightly connected, but such a reorganization would
unduly increase merge cost.)
Index: argp/argp-help.c
===================================================================
--- argp/argp-help.c (revision 15585)
+++ argp/argp-help.c (working copy)
@@ -1874,6 +1874,7 @@
#endif
}
+#ifdef _LIBC
if (_IO_fwide (stream, 0) > 0)
{
#if ! _LIBC || __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
@@ -1883,6 +1884,7 @@
#endif
}
else
+#endif
putc_unlocked ('\n', stream);
#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
Index: argp/argp-fmtstream.c
===================================================================
--- argp/argp-fmtstream.c (revision 15585)
+++ argp/argp-fmtstream.c (working copy)
@@ -102,7 +102,11 @@
__argp_fmtstream_update (fs);
if (fs->p > fs->buf)
{
+#ifdef _LIBC
__fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf);
+#else
+ fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
+#endif
}
free (fs->buf);
free (fs);
@@ -147,6 +151,7 @@
size_t i;
for (i = 0; i < pad; i++)
{
+#ifdef _LIBC
if (_IO_fwide (fs->stream, 0) > 0)
{
#if ! _LIBC || __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
@@ -156,6 +161,7 @@
#endif
}
else
+#endif
putc_unlocked (' ', fs->stream);
}
}
@@ -316,6 +322,7 @@
*nl++ = ' ';
else
for (i = 0; i < fs->wmargin; ++i)
+#ifdef _LIBC
if (_IO_fwide (fs->stream, 0) > 0)
{
#ifdef OPTION_POSIX_WIDE_CHAR_DEVICE_IO
@@ -325,6 +332,7 @@
#endif
}
else
+#endif
putc_unlocked (' ', fs->stream);
/* Copy the tail of the original buffer into the current buffer
Index: ChangeLog.eglibc
===================================================================
--- ChangeLog.eglibc (revision 15585)
+++ ChangeLog.eglibc (working copy)
@@ -1,3 +1,8 @@
+2011-10-26 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
+
+ * argp/argp-fmtstream.c, argp/argp-help.c: Condition uses of
+ libc-internal interfaces on _LIBC.
+
2011-10-25 Michael Hope <michael.hope@xxxxxxxxxx>
* aclocal.m4 (PKGVERSION_TEXI): Define.
--
Joseph S. Myers
joseph@xxxxxxxxxxxxxxxx
_______________________________________________
Patches mailing list
Patches@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/patches