return g_ascii_formatd (buffer, buf_len, "%.17g", d);
}
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+
/**
* g_ascii_formatd:
* @buffer: A buffer to place the resulting string in
locale_t old_locale;
old_locale = uselocale (get_C_locale ());
- _g_snprintf (buffer, buf_len, format, d);
+ _g_snprintf (buffer, buf_len, format, d);
uselocale (old_locale);
return buffer;
return buffer;
#endif
}
+#pragma GCC diagnostic pop
#define ISSPACE(c) ((c) == ' ' || (c) == '\f' || (c) == '\n' || \
(c) == '\r' || (c) == '\t' || (c) == '\v')
}
/**
+ * g_str_is_ascii:
+ * @string: a string.
+ *
+ * Determines if a string is pure ASCII. A string is pure ASCII if it
+ * contains no bytes with the high bit set.
+ *
+ * Returns: %TRUE if @string is ascii
+ *
+ * Since: 2.40
+ **/
+gboolean
+g_str_is_ascii (const gchar *string)
+{
+ gint i;
+
+ for (i = 0; string[i]; i++)
+ if (string[i] & 0x80)
+ return FALSE;
+
+ return TRUE;
+}
+
+/**
* g_strdown:
* @string: the string to convert.
*
* it doesn't work on many encodings at all, including UTF-8, EUC-JP,
* etc.
*
- * There are therefore two replacement functions: g_ascii_strncasecmp(),
+ * There are therefore two replacement techniques: g_ascii_strncasecmp(),
* which only works on ASCII and is not locale-sensitive, and
- * g_utf8_casefold(), which is good for case-insensitive sorting of UTF-8.
+ * g_utf8_casefold() followed by strcmp() on the resulting strings, which is
+ * good for case-insensitive sorting of UTF-8.
**/
gint
g_strncasecmp (const gchar *s1,