mcedit issues
Roland Illig
roland.illig at gmx.de
Thu Nov 4 21:44:48 UTC 2004
Andrew V. Samoilov wrote:
> your last "simplification" remove charset conversion.
> Also some people collect all of used glib stuff in our glibcompat.c
> to eliminate libglib dependancy, and so you enforce them to import g_string_*()
> there.
I would like to apply only this small patch for editcmd.c.
Justification for the use of GString
====================================
I like the data type GString because it is already available in glib-1.2
as well as glib-2.0, it is easy to use, and you don't have to worry
about the maximum length of your strings.
from src/subshell.c:694:
/*
* Factor 5 because we need \, 0 and 3 other digits per character
* in the worst case (tcsh and zsh).
*/
d = ret = g_malloc (5 * strlen (s) + 16);
This could be changed to:
ret = g_string_new ("");
...
g_string_appendc (ret, 'x');
g_string_append (ret, "foobar");
Another feature is that getting the string's length will have a time
cost of O(1), while the strlen() function has a time cost of O(strlen(s)).
Roland
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mcedit-charset.patch
Type: text/x-patch
Size: 716 bytes
Desc: not available
URL: <http://lists.midnight-commander.org/pipermail/mc-devel/attachments/20041104/4844a542/attachment.bin>
More information about the mc-devel
mailing list