| 204 | } |
| 205 | |
| 206 | char *utf8_str(const tal_t *ctx, const u8 *buf TAKES, size_t buflen) |
| 207 | { |
| 208 | char *ret; |
| 209 | |
| 210 | if (!utf8_check(buf, buflen)) { |
| 211 | if (taken(buf)) |
| 212 | tal_free(buf); |
| 213 | return NULL; |
| 214 | } |
| 215 | |
| 216 | /* Add one for nul term */ |
| 217 | ret = tal_dup_arr(ctx, char, (const char *)buf, buflen, 1); |
| 218 | ret[buflen] = '\0'; |
| 219 | return ret; |
| 220 | } |
| 221 | |
| 222 | int tmpdir_mkstemp(const tal_t *ctx, const char *template TAKES, char **created) |
| 223 | { |
no test coverage detected