MCPcopy Create free account
hub / github.com/ElementsProject/lightning / utf8_str

Function utf8_str

common/utils.c:191–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189}
190
191char *utf8_str(const tal_t *ctx, const u8 *buf TAKES, size_t buflen)
192{
193 char *ret;
194
195 if (!utf8_check(buf, buflen)) {
196 tal_free_if_taken(buf);
197 return NULL;
198 }
199
200 /* Add one for nul term */
201 ret = tal_dup_arr(ctx, char, (const char *)buf, buflen, 1);
202 ret[buflen] = '\0';
203 return ret;
204}
205
206char *tal_strdup_or_null(const tal_t *ctx, const char *str)
207{

Callers 2

json_add_datastoreFunction · 0.85
decode_dFunction · 0.85

Calls 2

tal_free_if_takenFunction · 0.85
utf8_checkFunction · 0.70

Tested by

no test coverage detected