mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-23 17:14:22 +01:00
common/utils: add tal_strdup_or_null helper.
It's not that uncommon to want to pass NULL through, for optional strings. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -88,6 +88,9 @@ bool utf8_check(const void *buf, size_t buflen);
|
||||
/* Check it's UTF-8, return copy (or same if TAKES), or NULL if not valid. */
|
||||
char *utf8_str(const tal_t *ctx, const u8 *buf TAKES, size_t buflen);
|
||||
|
||||
/* Strdup, or pass through NULL */
|
||||
char *tal_strdup_or_null(const tal_t *ctx, const char *str);
|
||||
|
||||
/* Use the POSIX C locale. */
|
||||
void setup_locale(void);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user