Closed benma closed 1 year ago
Hi @benma,
We currently allocate for the wrapped languages which assume ownership of output strings. I'm happy to add a non-wrapped call that doesn't allocate though (which would be available only through C/C++ and compatible languages). Does that work for your use case?
@jgriffiths I see. It would be great if you could add such a function, thanks!
https://github.com/ElementsProject/libwally-core/blob/c102e7e8c7899822666e22d6cbcdaa8a1f444d38/src/bip39.c#L77
Why is the heap used here, even though the string could just be returned as is?
It would much more efficient and easier to use if we libwally exposed the
wordlist_lookup_index()
function instead, which returns the pointer to the existing string. Looping through all words right now for example requires malloc/free in each iteration.