[dev] Re: [libutf] Proposal for additional rune utility functions

From: Connor Lane Smith <cls_AT_lubutu.com>
Date: Tue, 10 Feb 2015 22:07:52 +0000


It's been a while since I posted to this list. I do still maintain
libutf, though -- glad to hear it's still being of use.

It sounds like it might be a good idea to add these to the library.
However, I have some simplification suggestions, especially to avoid
memory allocation inside libutf. I've attached a file illustrating the
functions as I think they should be (albeit untested). Your
'chartorunearr' could, in this case, be implemented like so:

> Rune *p = emalloc((utflen(s) + 1) * sizeof *p);
> utftorunestr(s, p);

Does this seem alright to you?

I don't have strong opinions on the 'where to put them' question. I
suppose we could split out every function into its own file, as others
have suggested. On the other hand, if 'utftorunestr' were to go in a
larger file of functions then I would actually suggest a runestr.c,
which doesn't exist yet but may as well; see runestrcat(3).


Received on Tue Feb 10 2015 - 23:07:52 CET

This archive was generated by hypermail 2.3.0 : Tue Feb 10 2015 - 23:12:06 CET