diff options
author | Tor Lillqvist <tml@src.gnome.org> | 1999-08-02 23:16:32 +0000 |
---|---|---|
committer | Tor Lillqvist <tml@src.gnome.org> | 1999-08-02 23:16:32 +0000 |
commit | 1c6c7f748956caae98a79be89120c537c2032b7e (patch) | |
tree | 965a457908d085029b1722a26247183239df6250 /glib.h | |
parent | 4877766d0efcf6ab78300a4beab8fab5e9749fa5 (diff) | |
download | glib-1c6c7f748956caae98a79be89120c537c2032b7e.tar.gz |
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.
Diffstat (limited to 'glib.h')
-rw-r--r-- | glib.h | 26 |
1 files changed, 14 insertions, 12 deletions
@@ -1500,7 +1500,7 @@ gchar* g_strchomp (gchar *string); #define g_strstrip( string ) g_strchomp (g_strchug (string)) /* String utility functions that return a newly allocated string which - * ought to be freed from the caller at some point. + * ought to be freed with g_free from the caller at some point. */ gchar* g_strdup (const gchar *str); gchar* g_strdup_printf (const gchar *format, @@ -1515,21 +1515,23 @@ gchar* g_strconcat (const gchar *string1, ...); /* NULL terminated */ gchar* g_strjoin (const gchar *separator, ...); /* NULL terminated */ -/* Copy a string interpreting C string -style escape sequences. - * The recognized sequences are \b \f \n \r \t \\ \" and the octal format. +/* Make a copy of a string interpreting C string -style escape + * sequences. Inverse of g_strescape. The recognized sequences are \b + * \f \n \r \t \\ \" and the octal format. */ -gchar* g_strccpy (gchar *dest, - const gchar *source); +gchar* g_strcompress (const gchar *source); + /* Copy a string escaping nonprintable characters like in C strings. - * Inverse of g_strccpy. The exceptions parameter if non-NULL points - * to a string containing characters that are not escaped. + * Inverse of g_strcompress. The exceptions parameter, if non-NULL, points + * to a string containing characters that are not to be escaped. */ -gchar* g_strecpy (gchar *dest, - const gchar *source, +gchar* g_strescape (const gchar *source, const gchar *exceptions); - -/* deprecated function (used to be a real function) */ -#define g_strescape(src) g_strecpy (g_new (char, strlen (src)*4+1), (src), NULL) +/* Deprecated API: + * gchar* g_strescape (const gchar *source); + * Luckily this function wasn't much used. + * Add a second NULL parameter in calls for mostly identical semantics. + */ gpointer g_memdup (gconstpointer mem, guint byte_size); |