RE: g_string_free



Why don't you just return the GString?

-tony


On 29-Jul-2000 Michael Meeks wrote:
> 
> I was just using g_string_free for the umpteenth time, and I
> wondered; would it be possible to return the ->str member from
> the free method ( if free_segment == FALSE ) ?
> 
> Then I can remove lines and tedium from my code having:
> 
>       GString *str = g_string_new ("foo");
>       g_string_append (str, "baa");
>       return g_string_free (str, FALSE);
> 
> Instead of:
> 
>       GString *str = g_string_new ("foo");
>       char    *p;
>       g_string_append (str, "baa");
>       p = str->_str;
>       g_string_free (str, FALSE);
>       return p;
> 
> Which I'm sure you'll agree is rather longer and
> more tedious. I'm certain the overhead will be
> negligable. If it sounds good, but due to
> maintainer overload it is not possible to do, I
> could make a patch up if you desire :-)
> 

---
E-Mail: trog@gtk.org
What scoundrel stole the cork from my lunch?
		-- J.D. Farley

Go Bezerk! http://www.gtk.org/~trog




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