GSettings: fix check for delaying backend subscription
[platform/upstream/glib.git] / gio / gvdb / gvdb-builder.c
index fdd0ef4..48fe3e4 100644 (file)
@@ -12,9 +12,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  *
  * Author: Ryan Lortie <desrt@desrt.ca>
  */
@@ -24,7 +22,9 @@
 
 #include <glib.h>
 #include <fcntl.h>
+#if !defined(G_OS_WIN32) || !defined(_MSC_VER)
 #include <unistd.h>
+#endif
 #include <string.h>
 
 
@@ -91,7 +91,7 @@ djb_hash (const gchar *key)
   guint32 hash_value = 5381;
 
   while (*key)
-    hash_value = hash_value * 33 + *key++;
+    hash_value = hash_value * 33 + *(signed char *)key++;
 
   return hash_value;
 }
@@ -178,6 +178,14 @@ hash_table_new (gint n_buckets)
 }
 
 static void
+hash_table_free (HashTable *table)
+{
+  g_free (table->buckets);
+
+  g_slice_free (HashTable, table);
+}
+
+static void
 hash_table_insert (gpointer key,
                    gpointer value,
                    gpointer data)
@@ -417,6 +425,8 @@ file_builder_add_hash (FileBuilder         *fb,
           index++;
         }
     }
+
+  hash_table_free (mytable);
 }
 
 static FileBuilder *
@@ -472,6 +482,8 @@ file_builder_serialise (FileBuilder          *fb,
 
       g_string_append_len (result, chunk->data, chunk->size);
       g_free (chunk->data);
+
+      g_slice_free (FileChunk, chunk);
     }
 
   g_queue_free (fb->chunks);