Re: How gvdb_table_is_valid works on glib/dconf

2011-03-22 Thread Ryan Lortie
hi Joshua On 11-02-16 04:09 AM, Joshua Lee wrote: I can not understand while gvdb_table_is_valid can check the on-disk gvdb table is valid. The very first thing that comes in any GVDB file is the string "GVariant". That's normally why *data should be non-zero, so !!*data will be 1. When d

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

2011-02-16 Thread jcupitt
On 16 February 2011 10:50, Joshua Lee wrote: > I'm curious why gvdb_table_is_valid works. Here's the implementation > of gvdb_table_is_valid. > > gboolean > gvdb_table_is_valid (GvdbTable *table) > { >  return !!*table->data; > } Ah I see, sorry. This function will return 1 if table->data points

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

2011-02-16 Thread Joshua Lee
Hi jcupitt, I'm curious why gvdb_table_is_valid works. Here's the implementation of gvdb_table_is_valid. /** * gvdb_table_is_valid:

Re: How gvdb_table_is_valid works on glib/dconf

2011-02-16 Thread jcupitt
On Wednesday, 16 February 2011, Joshua Lee 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 alwa

How gvdb_table_is_valid works on glib/dconf

2011-02-16 Thread Joshua Lee
Hi Ryan/All, I can not understand while gvdb_table_is_valid can check the on-disk gvdb table is valid. Then i wrote a simple sample to verify it. """ #include #include int main() { GError *err = NULL; gchar *data = NULL; system("echo 'Hello' >/tmp/mapped.txt");