Re: Problems using g_queue_find
- From: David Nečas (Yeti) <yeti physics muni cz>
- To: gtk-app-devel-list gnome org
- Subject: Re: Problems using g_queue_find
- Date: Wed, 12 Jul 2006 22:51:57 +0200
On Wed, Jul 12, 2006 at 08:05:56PM +0100, Adam Tee wrote:
I am having an issue when using g_queue_find. Basically, I am using it
to find a filename in a queue but it is returning NULL all the time even
when the filename is there.
The code I am using is:
if(g_queue_find(gui->prefs->history, gui->si->filename->str))
{
#ifdef DEBUG
g_print("File not in history list\n");
#endif
if(g_queue_get_length(gui->prefs->history) > MAX_HISTORY)
{
gpointer data = g_queue_pop_head(gui->prefs->history);
if(data)
g_free(data);
}
history is a queue containing strings as its data.
Is there anything obvious with this code ??
Is the string gui->si->filename->str *physically* the same
string (i.e. the same pointer) as some data in the queue?
g_queue_find() simply compares pointers, to check for an
equal string you have to use g_queue_find_custom() with
string comparison.
Yeti
--
Anonyms eat their boogers.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]