diff --git a/src/util/string.h b/src/util/string.h index 76f2f403f..4d8bc72c4 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -182,6 +182,7 @@ struct string { * @returns @a string if successful, or NULL if out of memory. * @post done_string(@a string) is safe, even if this returned NULL. * @relates string */ +#ifdef _cplusplus #ifdef DEBUG_MEMLEAK [[nodiscard]] struct string *init_string__(const char *file, int line, struct string *string); #define init_string(string) init_string__(__FILE__, __LINE__, string) @@ -189,6 +190,16 @@ struct string { [[nodiscard]] struct string *init_string(struct string *string); #endif +#else + +#ifdef DEBUG_MEMLEAK +struct string *init_string__(const char *file, int line, struct string *string); +#define init_string(string) init_string__(__FILE__, __LINE__, string) +#else +struct string *init_string(struct string *string); +#endif + +#endif /** Resets @a string and free()s the string.source member. * @relates string */ void done_string(struct string *string);