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

From: FRIGN <>
Date: Wed, 11 Feb 2015 01:20:01 +0100

On Tue, 10 Feb 2015 22:07:52 +0000
Connor Lane Smith <> wrote:

> 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);

I like this approach and the way you wrote the functions! :)
And using "utf" instead of "char" also makes more sense.

> 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).

That would also be very consistent. What do the others think?



Received on Wed Feb 11 2015 - 01:20:01 CET

This archive was generated by hypermail 2.3.0 : Wed Feb 11 2015 - 01:24:14 CET