Re: GLib substr function



Am Fri, 26 Jun 2009 18:52:10 +0200
schrieb Daniel Elstner <daniel kitta googlemail com>:

> Am Freitag, den 10.04.2009, 14:08 +0200 schrieb Christian Dywan:
> 
> > For the sake of demonstration, it took me 2 minutes to write a
> > simple substring function in C that does what you want, have a look
> > how it works. :)
> 
> It doesn't.  Your function allocates memory using a byte count but
> then uses the same value for the number of characters to copy.
> 
> --Daniel

Oh well,

so you dug up a two and a half month old message of mine to point out
that 2 minutes are enough to make a stupid mistake. :)

You're right, it's not correct for UTF8 strings. I suppose it's good
you pointed it out in case somebody else actually used the example as-is
without noticing my mistake.

Regards,
    Christian


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]