Re: Re: How gvdb_table_is_valid works on glib/dconf??



Hi jcupitt,
I'm curious why gvdb_table_is_valid works. Here's the implementation
of gvdb_table_is_valid. 

/**                                                                                                         * gvdb_table_is_valid:                                                                                     * @table: a #GvdbTable                                                                                     * @returns: %TRUE if @table is still valid                                                                 *                                                                                                          * Checks if the table is still valid.                                                                      *                                                                                                          * An on-disk GVDB can be marked as invalid.  This happens when the
 file                                    
 * has been replaced.  The appropriate action is typically to reopen
 the                                    
 * file.                                                                                                    **/
gboolean
gvdb_table_is_valid (GvdbTable *table)
{
  return !!*table->data;
}

Best regards,
Joshua

On Wed, 16 Feb 2011, jcupitt gmail com wrote:

> On Wednesday, 16 February 2011, Joshua Lee <muzili gmail com> wrote:
> > Then I run the test program, !!*data will always output 1. Here's the
> > output.
> 
> Isn't that expected behaviour? Data points to a non-empty string, so
> *data will always be non-zero. Therefore !*data will always be zero,
> therefore !!*data will always be 1.
> 
> John

-- 
Joshua Lee
Alpha Networks(Chengdu) Co., LTD
Shanghai Branch

TEL: (86-21)61609650 EXT: 8020
FAX: (86-21)61609650 EXT: 8041
ADD: Suite 301, No.10, 198 Lane, Zhangheng Road,
     ZJ Hi-Tech Park, Shanghai, China 201204



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