mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-28 20:04:14 +02:00
glib.h gstrfuncs.c Rename g_strccpy to g_strcompress and g_strecpy to
* glib.h * gstrfuncs.c * tests/strfunc-test.c: Rename g_strccpy to g_strcompress and g_strecpy to g_strescape per Tim Janik's suggestion. Dropped the destination parameter, always g_malloc a new string. Fix bug in g_strcompress, octal digits were gobbled up without limit, should use max three. Sources that use g_strescape must have ifdefs to be compilable both with GLib 1.2 and 1.3.
This commit is contained in:
@@ -99,15 +99,14 @@ main (int argc,
|
||||
g_assert (strcmp(string, "00021 test ") == 0);
|
||||
g_free (string);
|
||||
|
||||
g_assert (strcmp(g_strccpy(g_malloc(100),
|
||||
"abc\\\\\\\"\\b\\f\\n\\r\\t\\003\\177\\234\\313"),
|
||||
"abc\\\"\b\f\n\r\t\003\177\234\313") == 0);
|
||||
g_assert (strcmp(g_strecpy(g_malloc(100),
|
||||
"abc\\\"\b\f\n\r\t\003\177\234\313",
|
||||
NULL),
|
||||
g_assert (strcmp
|
||||
(g_strcompress("abc\\\\\\\"\\b\\f\\n\\r\\t\\003\\177\\234\\313\\12345z"),
|
||||
"abc\\\"\b\f\n\r\t\003\177\234\313\12345z") == 0);
|
||||
g_assert (strcmp(g_strescape("abc\\\"\b\f\n\r\t\003\177\234\313",
|
||||
NULL),
|
||||
"abc\\\\\\\"\\b\\f\\n\\r\\t\\003\\177\\234\\313") == 0);
|
||||
g_assert (strcmp(g_strecpy(g_malloc(100),"abc\\\"\b\f\n\r\t\003\177\234\313",
|
||||
"\b\f\001\002\003\004"),
|
||||
g_assert (strcmp(g_strescape("abc\\\"\b\f\n\r\t\003\177\234\313",
|
||||
"\b\f\001\002\003\004"),
|
||||
"abc\\\\\\\"\b\f\\n\\r\\t\003\\177\\234\\313") == 0);
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user