Re: [evolution-patches] Fix for bug#306986



må 2005-12-19 klockan 15:12 +0530 skrev Sankar P:
> strlen(word) can be saved in some temporary variable so as to avoid
> these many function calls.

True.

> This makes a string <<'word'\0>> to <<word\0'\0>> 
> 
> Wont this be leaking memory when we issue the g_free by passing the
> base-address of the string, Since char beyond \0 (the apostophe) wont be
> freed at all?

Er, huh?

> so that the movement of characters will be internally taken care by GLib
> in an efficient manner using g_memmove.

I doubt very much that it will make any noticeable difference, and
whether it makes the code any easier to read is debatable. If you want
to use g_memmove() here instead of moving bytes one by one, just call
g_memmove (word, word+1, strlen(word)-1) (or something like that).
Replacing the quotes with spaces and calling g_strstrip() seems a rather
awkward way to get the same end result.

--tml






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