mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-27 05:29:27 +03:00
* util.h: Added the function free_after for easier handling of dynamically allocated strings.
This commit is contained in:
parent
c6e3dde5a5
commit
d3a5b40c19
@ -1,3 +1,7 @@
|
|||||||
|
2004-18-19 Roland Illig <roland.illig@gmx.de>
|
||||||
|
* util.h: Added the function free_after for easier handling
|
||||||
|
of dynamically allocated strings.
|
||||||
|
|
||||||
2004-18-19 Roland Illig <roland.illig@gmx.de>
|
2004-18-19 Roland Illig <roland.illig@gmx.de>
|
||||||
* util.c: Added the function str_replace, which replaces
|
* util.c: Added the function str_replace, which replaces
|
||||||
all occurences of a character in a string.
|
all occurences of a character in a string.
|
||||||
|
11
src/util.h
11
src/util.h
@ -172,4 +172,15 @@ void save_file_position (char *filename, long line, long column);
|
|||||||
#define ISASCII(c) isascii(c)
|
#define ISASCII(c) isascii(c)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* this function allows you to write:
|
||||||
|
* char *s = g_strdup("hello, world");
|
||||||
|
* s = free_after(g_strconcat(s, s, NULL), s);
|
||||||
|
*/
|
||||||
|
static inline char *
|
||||||
|
free_after (char *result, char *string_to_free)
|
||||||
|
{
|
||||||
|
g_free(string_to_free);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* !__UTIL_H */
|
#endif /* !__UTIL_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user