Re: gtk_label_get_text() string duping



Tim Janik <timj@gtk.org> writes: 
> i can't really proove this. glancing at gnome-libs, the copying enforcement
> seems to be as random as in gtk (notably, it's mostly code from you or owen
> that bothers doing an extra copy).
>

Perhaps so, I don't know.
 
> definitely most of the non-string returning functions don't copy or add
> reference counts. i wouldn't know why they should even, since you can
> always copy()/ref() objects on your own, 

Right, the convention for non-string objects seems to be to return a
reference. The convention for strings is different.
 
> i'd btw apprechiate if you enlightened me on why string getters should do
> an extra copy at all. i'd guess that code like:

I don't have strong feelings on which way is the right way, I am just
worried about the practicality of reversing our decision on this.

> you didn't read my previous post very thoroughly then. if you have
> a module that does copying consistently all over the place, it's
> half an hour (actually less) of doing grep "char.*_get_" *.h
> and stuffing those functions into:
> 
> $ cat >rewrite.pl
> #!/usr/bin/perl -w -pi.bak
> 
> s/gnome_dock_item_get_name/gnome_dock_item_dup_name/g;
> s/gnome_file_entry_get_full_path/gnome_file_entry_dup_full_path/g;
> 
> then running rewrite.pl over your code.
>

OK, I'll buy that. But we need a volunteer to create a comprehensive
list of such functions in all major CVS modules (Pango, GTK, GConf,
gnome-libs, Bonobo, gnome-print, are some definite ones that come to
mind), then run the perl scripts on every single app in CVS. I'm _not_
doing this ;-) I think you need to volunteer for this before we even
consider it. We also need to get opinions from the maintainers of some
of these modules.

Basically what I'm saying is, this is a big change that affects tons
of people, we need a consensus from all of them and we need to make
sure that the work gets done 100% for all modules.

If you think it's worth the pain and Miguel etc. agree with you, then
I guess I don't have a complaint, but I am strongly opposed to
changing this in GTK only and leaving the overall set of libraries in
a totally inconsistent state.

Havoc





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