Add a note about casting the results of g_new() and g_new0().
[platform/upstream/glib.git] / glib / gkeyfile.c
index a779486..7a8a783 100644 (file)
@@ -355,7 +355,7 @@ g_key_file_load_from_fd (GKeyFile       *key_file,
                         GError        **error)
 {
   GError *key_file_error = NULL;
-  gsize bytes_read;
+  gssize bytes_read;
   struct stat stat_buf;
   gchar read_buf[4096];
   
@@ -1030,7 +1030,7 @@ g_key_file_get_keys (GKeyFile     *key_file,
        num_keys++;
     }
   
-  keys = (gchar **) g_new0 (gchar *, num_keys + 1);
+  keys = g_new0 (gchar *, num_keys + 1);
 
   i = num_keys - 1;
   for (tmp = group->key_value_pairs; tmp; tmp = tmp->next)
@@ -1107,7 +1107,7 @@ g_key_file_get_groups (GKeyFile *key_file,
    * list) is always the comment group at the top,
    * which we skip
    */
-  groups = (gchar **) g_new0 (gchar **, num_groups);
+  groups = g_new0 (gchar *, num_groups);
 
   group_node = g_list_last (key_file->groups);
   
@@ -2989,14 +2989,9 @@ g_key_file_line_is_group (const gchar *line)
 
   p = g_utf8_next_char (p);
 
-  if (!*p)
-    return FALSE;
-
-  p = g_utf8_next_char (p);
-
   /* Group name must be non-empty
    */
-  if (*p == ']')
+  if (!*p || *p == ']')
     return FALSE;
 
   while (*p && *p != ']')