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

Memory woes



Hello All!
I'm getting my hands dirrty with Pan. I have the following struct:
******************************************************************************
typedef struct _Group
{
	GMutex       * article_mutex;

        guint          loaded_since_last_fetch  : 1;
        guint          articles_dirty           : 1;     
	char           permission;                       
	gint8          flags;                            
	gint8          old_sort_style;                   
	gint8          new_sort_style;                   
	gulong         filter_show;                      
	guint32        filter_bits;                      
	gint32         article_qty;                      
	gint32         article_read_qty;                 
	gulong         article_low;                      
	gulong	       article_last_low_fetched;
	gulong         article_high;                     
	gulong         article_high_old;                 

	Server       * server;
	char         * name;                             
	char         * filter_name;                      
	char         * identity_name;                    
	char         * description;                      /* maybe null */
	char         * download_dir;                     
	char         * default_charset;                  
	GStringChunk * chunk;                            

	/* PRIVATE */
	int            _articles_refcount;
	MemChunk     * _article_chunk;                   /* Article objects */
	Newsrc       * _newsrc;                          
	Newsrc       * _purged;                          
	GHashTable   * _articles;                        
	GPtrArray    * _deleted_articles;                
	char         * _one_big_chunk;                   
	guint          _no_fetch_on_load	: 1;	 
}
Group;
*****************************************************************************

Something like: Group * g = group_new(server, name);

returns a properly initialized, complete Group, with all the above members
as reported by gdb. I add those Group's to a GPtrArray like so:

                GPtrArray * groups = g_ptr_array_new ();
        	g_ptr_array_add (groups, g);

then            call_some_func((Group **) groups->pdata);

but inside call_some_func(Group **groups), for all x, on
  
                print *groups[x]  

gdb does not see the last member, _no_fetch_on_load. However, the compiler does
not complain about an unknown member. Instead, 

       if (!groups[x]->_no_fetch_on_load) fetch_headers();

would _always_ make the call to fetch_headers(), even though I had set 
_no_fetch_on_load to TRUE before getting to that point. Anyone has any idea,
could provide any hint about what's going on here? I've tried using a gboolean
instead of a guint _no_fetch_on_load, but same problem. Also, what does the
':1'
mean in "guint loaded_since_last_fetch : 1" ? Is it a compiler extension or is
it standard C ?

Thanks,
Rico.
 

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/



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