about summary refs log tree commit diff
path: root/support/support.h
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2021-10-12 13:48:39 +0000
committerJoseph Myers <joseph@codesourcery.com>2021-10-12 13:48:39 +0000
commitde82cb0da4b8fa5b3d56c457438d2568c67ab1b1 (patch)
tree396836ad8aa0a466b0cc8a379c6933b972780ce9 /support/support.h
parent4912c738fcbc6def723370ec3a7ab4a732361322 (diff)
downloadglibc-de82cb0da4b8fa5b3d56c457438d2568c67ab1b1.tar.gz
glibc-de82cb0da4b8fa5b3d56c457438d2568c67ab1b1.tar.xz
glibc-de82cb0da4b8fa5b3d56c457438d2568c67ab1b1.zip
Add TEST_COMPARE_STRING_WIDE to support/check.h
I'd like to be able to test narrow and wide string interfaces, with
the narrow string tests using TEST_COMPARE_STRING and the wide string
tests using something analogous (possibly generated using macros from
a common test template for both the narrow and wide string tests where
appropriate).

Add such a TEST_COMPARE_STRING_WIDE, along with functions
support_quote_blob_wide and support_test_compare_string_wide that it
builds on.  Those functions are built using macros from common
templates shared by the narrow and wide string implementations, though
I didn't do that for the tests of test functions.  In
support_quote_blob_wide, I chose to use the \x{} delimited escape
sequence syntax proposed for C2X in N2785, rather than e.g. trying to
generate the end of a string and the start of a new string when
ambiguity would result from undelimited \x (when the next character
after such an escape sequence is valid hex) or forcing an escape
sequence to be used for the next character in the case of such
ambiguity.

Tested for x86_64.
Diffstat (limited to 'support/support.h')
-rw-r--r--support/support.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/support/support.h b/support/support.h
index 837a806531..0ee454da6d 100644
--- a/support/support.h
+++ b/support/support.h
@@ -73,6 +73,12 @@ void support_write_file_string (const char *path, const char *contents);
    the result).  */
 char *support_quote_blob (const void *blob, size_t length);
 
+/* Quote the contents of the wide character array starting at BLOB, of
+   LENGTH wide characters, in such a way that the result string can be
+   included in a C wide string literal (in single/double quotes,
+   without putting the quotes into the result).  */
+char *support_quote_blob_wide (const void *blob, size_t length);
+
 /* Quote the contents of the string, in such a way that the result
    string can be included in a C literal (in single/double quotes,
    without putting the quotes into the result).  */