annotate lib/wcsrtombs.c @ 40231:9b3c79fdfe0b

strtod: fix clash with strtold Problem reported for RHEL 5 by Jesse Caldwell (Bug#34817). * lib/strtod.c (compute_minus_zero, minus_zero): Simplify by remving the macro / external variable, and having just a function. User changed. This avoids the need for an external variable that might clash.
author Paul Eggert <eggert@cs.ucla.edu>
date Mon, 11 Mar 2019 16:40:29 -0700
parents b06060465f09
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10941
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Convert wide string to string.
40057
b06060465f09 maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents: 19484
diff changeset
2 Copyright (C) 2008, 2010-2019 Free Software Foundation, Inc.
10941
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3 Written by Bruno Haible <bruno@clisp.org>, 2008.
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 This program is free software: you can redistribute it and/or modify
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 it under the terms of the GNU General Public License as published by
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 the Free Software Foundation; either version 3 of the License, or
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8 (at your option) any later version.
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 GNU General Public License for more details.
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
19190
9759915b2aca all: prefer https: URLs
Paul Eggert <eggert@cs.ucla.edu>
parents: 18626
diff changeset
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
10941
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18 #include <config.h>
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20 /* Specification. */
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 #include <wchar.h>
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22
10943
47cd92ce639a New module 'wcsnrtombs'.
Bruno Haible <bruno@clisp.org>
parents: 10941
diff changeset
23 extern mbstate_t _gl_wcsrtombs_state;
10941
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24
13962
d08e3bdd07f9 wcsrtombs: Don't confuse mbstate_t with rpl_mbstate_t.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
25 #if HAVE_WCSRTOMBS && !WCSRTOMBS_TERMINATION_BUG && !defined GNULIB_defined_mbstate_t
10941
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 /* Override the system's wcsrtombs() function. */
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 # undef wcsrtombs
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30 size_t
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31 rpl_wcsrtombs (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps)
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 {
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33 if (ps == NULL)
10943
47cd92ce639a New module 'wcsnrtombs'.
Bruno Haible <bruno@clisp.org>
parents: 10941
diff changeset
34 ps = &_gl_wcsrtombs_state;
10941
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35 # if WCSRTOMBS_NULL_ARG_BUG
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 if (dest == NULL)
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37 {
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 const wchar_t *temp_src = *srcp;
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39
14337
72901df54787 wcsrtombs: Work around bug on native Windows.
Bruno Haible <bruno@clisp.org>
parents: 14263
diff changeset
40 return wcsrtombs (NULL, &temp_src, (size_t)-1, ps);
10941
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 }
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 else
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43 # endif
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44 return wcsrtombs (dest, srcp, len, ps);
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
45 }
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
46
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47 #else
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
48 /* Implement wcsrtombs on top of wcrtomb(). */
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
49
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50 # include <errno.h>
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
51 # include <stdlib.h>
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
52 # include <string.h>
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
53
14263
72a370719412 wcsrtombs: Prepare for new module wwcsrtombs.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
54 # include "wcsrtombs-impl.h"
10941
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
55
509592900669 New module 'wcsrtombs'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
56 #endif