Jesper Skov wrote:
>
> >>>>> "Mike" == Mike Nordell <[EMAIL PROTECTED]> writes:
>
> Mike> Instead of just quietly fixing this, I had to go on ranting
> Mike> about it. ev_Menu_Labels.cpp v. 1.16 got a nasty
> Mike> bug. Potentially a killer if left as-is. Even Dom that updated
> Mike> that file to 1.17 missed that bug. May I humbly suggest that if
> Mike> using strings in this way, and don't know the difference between
> Mike> malloc/calloc & new, use the string class UT_String I added.
>
> Mike> I've apparently forgotten how challanging memory management can
> Mike> be to some, why I after seeing this bug reintroduced for the
> Mike> 4711:th time suggests that this micro-management of memory
> Mike> should be forwarded to some entity that ease the burden off you:
> Mike> UT_String. I actually think we should throw UT_cloneString away
> Mike> and never look back.
>
> FWIW, IMO we should only have one string alloc/free scheme. If it's
> packed away in a dedicated class, all the better.
>
> I just did a grep for malloc/calloc over the sources, and quite a few
> of those are used for strings. I haven't looked at your string class,
> Mike, but would it be suitable for all instances of string usage in
> AbiWord? If so, I think we should change them all to use it, and put
> it as a coding style requirement.
IMHO, this will be a very good idea. Unfortunately, sometimes we will
be forced to use the classic (char *) stuff (Mike's class is a bit
little and doesn't has all the operations available at ut_string.h), but
IMO Mike's class should be used in the 90% of the cases.
It should reduce memory management bugs, and the code will be cleaner.
Cheers,
--
Joaquín Cuenca Abela
[EMAIL PROTECTED]