mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 07:26:15 +01:00
Merge branch 'ascii-formatd-libc-dep' into 'main'
Improve g_ascii_formatd docs and preconditions See merge request GNOME/glib!2440
This commit is contained in:
commit
d83c7b8699
@ -927,7 +927,7 @@ g_ascii_dtostr (gchar *buffer,
|
||||
* @buffer: A buffer to place the resulting string in
|
||||
* @buf_len: The length of the buffer.
|
||||
* @format: The printf()-style format to use for the
|
||||
* code to use for converting.
|
||||
* code to use for converting
|
||||
* @d: The #gdouble to convert
|
||||
*
|
||||
* Converts a #gdouble to a string, using the '.' as
|
||||
@ -935,6 +935,9 @@ g_ascii_dtostr (gchar *buffer,
|
||||
* a printf()-style format string. Allowed conversion
|
||||
* specifiers are 'e', 'E', 'f', 'F', 'g' and 'G'.
|
||||
*
|
||||
* The @format must just be a single format specifier
|
||||
* starting with `%`, expecting a #gdouble argument.
|
||||
*
|
||||
* The returned buffer is guaranteed to be nul-terminated.
|
||||
*
|
||||
* If you just want to want to serialize the value into a
|
||||
@ -951,6 +954,10 @@ g_ascii_formatd (gchar *buffer,
|
||||
#ifdef USE_XLOCALE
|
||||
locale_t old_locale;
|
||||
|
||||
g_return_val_if_fail (buffer != NULL, NULL);
|
||||
g_return_val_if_fail (format[0] == '%', NULL);
|
||||
g_return_val_if_fail (strpbrk (format + 1, "'l%") == NULL, NULL);
|
||||
|
||||
old_locale = uselocale (get_C_locale ());
|
||||
_g_snprintf (buffer, buf_len, format, d);
|
||||
uselocale (old_locale);
|
||||
|
Loading…
Reference in New Issue
Block a user