Quoting Emile le Vivre <[EMAIL PROTECTED]> from ml.softs.gtk-gnutella.devel:
:So, probably the best solution is to create another list of structures
:to hold info only need by the GUI for each search. This will include
:"filename", "host", etc. thereby also cleaning up the double usage of
:the search results records we were doing before. ie. The "GUI" will
:only worry about and manipulate the gui records and the core can worry
:about manipulating the search result records. The only disadvantage to
:this is a bunch of duplicated values between the search result records
:and the new "gui" search result records which means increased memory
:usage.
Well, there's nothing wrong in creating another structure for the GUI
only, but this structure would need to reference back to the shared
records, because you can have many passive searches. And then you can
add the '#' count there, in the GUI structure.
But I don't see why you would like to duplicate filename, host, etc...
Those will be common for all the passive searches. Remember: one can
open 10 passive searches, each filled with 5000 max results. We don't
want to duplicate the memory of all the records displayed, we need to
share that information and the code to do that is there.
[Those record data are already GUI-private, i.e. it's a duplication of
the core structures that were passed on].
The problem is that '#' is inherently non-shared, as you discovered.
Therefore, the Correct Fix (tm) seems to:
. Create a new structure:
struct {
record_t *shared;
/* Private data, pertaining to this search */
gint count;
};
. Adapt all the code to use that structure instead of the original record_t
for everything pertaining to records.
Don't forget to walloc() this structure, not malloc() it for performance
and memory fragmentation reasons.
What do you say?
Raphael
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Gtk-gnutella-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/gtk-gnutella-devel