Usage of g_strstrip && Re: [evolution-patches] Signature-editor



Hi Vivek,

I checked the implementation of the g_strstrip function and verified it
in the gtk-app-dev mailing list.

#define g_strstrip(string)   g_strchomp (g_strchug (string))

Both g_strchung and g_strchomp works with the string you passed to it
and does not allocate memory.

The first moves the text to the start of the buffer with g_memmove and
the second just places a null character in each space character from the
end of the buffer to the first non-space character.

So,
	name = g_strstrip ( g_strdup (gtk_entry_get_text(GTK_ENTRY
(name_entry))));
	g_free (name);
wont leak memory.

I will incorporate the other review comments along with the spacing
issues. (I dont understand how I missed). I will make the changes and
commit it to HEAD only since it adds new strings/functions.

Sankar P

On Mon, 2005-10-10 at 16:39 +0530, Vivek Jain wrote:
> hey sankar,
> 
> I see its a pretty good work done. Thanks for that.
> 
> Please correct your patch to fix:
> 
> 1. "name" should be freed 
> 2. Check for the usage of "g_strstrip" 
> 3. Some styling issues here and there (a self review will make you
> realize what you missed :))
> 4. The part of the error message "Change the name of your signature"
> should probably be like "Please specify a different name"
> 
> Other than that the patch looks ok to me.
> 
> Thanks,
> Vivek Jain
> 
> PS: Please do give a bit of detail about the work you have done in the
> mail to patches.




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