Renamed g_queue_create to g_queue_new in conformance to all other GLib
[platform/upstream/glib.git] / glib.h
diff --git a/glib.h b/glib.h
index 0379126..0772413 100644 (file)
--- a/glib.h
+++ b/glib.h
 #ifndef __G_LIB_H__
 #define __G_LIB_H__
 
+/* Here we provide G_GNUC_EXTENSION as an alias for __extension__,
+ * where this is valid. This allows for warningless compilation of
+ * "long long" types even in the presence of '-ansi -pedantic'. This
+ * of course should be with the other GCC-isms below, but then
+ * glibconfig.h wouldn't load cleanly and it is better to have that
+ * here, than in glibconfig.h.  
+ */
+#if    __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
+#  define G_GNUC_EXTENSION __extension__
+#else
+#  define G_GNUC_EXTENSION
+#endif
+
 /* system specific config file glibconfig.h provides definitions for
  * the extrema of many of the standard types. These are:
  *
@@ -265,7 +278,6 @@ extern "C" {
 #define        G_GNUC_UNUSED
 #endif /* !__GNUC__ */
 
-
 /* Wrap the gcc __PRETTY_FUNCTION__ and __FUNCTION__ variables with
  * macros, so we can refer to them as strings unconditionally.
  */
@@ -1047,7 +1059,7 @@ gpointer g_slist_nth_data (GSList         *list,
 
 /* Queues
  */
-GQueue*  g_queue_create         (void);
+GQueue*  g_queue_new            (void);
 void     g_queue_free           (GQueue  *queue);
 void     g_queue_push_head      (GQueue  *queue,
                                 gpointer data);
@@ -1159,6 +1171,7 @@ void     g_node_pop_allocator   (void);
 GNode*  g_node_new             (gpointer          data);
 void    g_node_destroy         (GNode            *root);
 void    g_node_unlink          (GNode            *node);
+GNode*   g_node_copy            (GNode            *node);
 GNode*  g_node_insert          (GNode            *parent,
                                 gint              position,
                                 GNode            *node);
@@ -1598,17 +1611,22 @@ gchar*   g_strjoin              (const gchar  *separator,
  */
 gchar*   g_strcompress         (const gchar *source);
 
+/* Convert between the operating system (or C runtime)
+ * representation of file names and UTF-8.
+ */
+gchar*   g_filename_to_utf8 (const gchar *opsysstring);
+gchar*   g_filename_from_utf8 (const gchar *utf8string);
+
 /* Copy a string escaping nonprintable characters like in C strings.
  * Inverse of g_strcompress. The exceptions parameter, if non-NULL, points
  * to a string containing characters that are not to be escaped.
+ *
+ * Deprecated API: gchar* g_strescape (const gchar *source);
+ * Luckily this function wasn't used much, using NULL as second parameter
+ * provides mostly identical semantics.
  */
 gchar*   g_strescape           (const gchar *source,
                                 const gchar *exceptions);
-/* Deprecated API:
- * gchar* g_strescape (const gchar *source);
- * Luckily this function wasn't much used.
- * Add a second NULL parameter in calls for mostly identical semantics.
- */
 
 gpointer g_memdup              (gconstpointer mem,
                                 guint         byte_size);
@@ -1818,19 +1836,29 @@ gchar*        g_string_chunk_insert_const  (GStringChunk *chunk,
 GString*     g_string_new              (const gchar     *init);
 GString*     g_string_sized_new         (guint           dfl_size);
 void        g_string_free              (GString         *string,
-                                        gint             free_segment);
-GString*     g_string_assign            (GString        *lval,
+                                        gboolean         free_segment);
+GString*     g_string_assign            (GString        *string,
                                         const gchar     *rval);
 GString*     g_string_truncate          (GString        *string,
                                         gint             len);
+GString*     g_string_insert_len        (GString         *string,
+                                         gint             pos,
+                                         const gchar     *val,
+                                         gint             len);
 GString*     g_string_append            (GString        *string,
                                         const gchar     *val);
+GString*     g_string_append_len        (GString        *string,
+                                        const gchar     *val,
+                                         gint             len);
 GString*     g_string_append_c          (GString        *string,
                                         gchar            c);
 GString*     g_string_prepend           (GString        *string,
                                         const gchar     *val);
 GString*     g_string_prepend_c         (GString        *string,
                                         gchar            c);
+GString*     g_string_prepend_len       (GString        *string,
+                                        const gchar     *val,
+                                         gint             len);
 GString*     g_string_insert            (GString        *string,
                                         gint             pos,
                                         const gchar     *val);
@@ -1964,7 +1992,7 @@ void        g_datalist_id_set_data_full    (GData          **datalist,
                                          GQuark           key_id,
                                          gpointer         data,
                                          GDestroyNotify   destroy_func);
-void     g_datalist_id_remove_no_notify (GData          **datalist,
+gpointer  g_datalist_id_remove_no_notify (GData                 **datalist,
                                          GQuark           key_id);
 void     g_datalist_foreach             (GData          **datalist,
                                          GDataForeachFunc func,
@@ -1994,7 +2022,7 @@ void        g_dataset_id_set_data_full    (gconstpointer    dataset_location,
                                         GQuark           key_id,
                                         gpointer         data,
                                         GDestroyNotify   destroy_func);
-void     g_dataset_id_remove_no_notify (gconstpointer    dataset_location,
+gpointer  g_dataset_id_remove_no_notify        (gconstpointer    dataset_location,
                                         GQuark           key_id);
 void     g_dataset_foreach             (gconstpointer    dataset_location,
                                         GDataForeachFunc func,
@@ -2889,6 +2917,12 @@ gint             g_win32_closedir        (DIR            *dir);
  */
 gchar *                g_win32_getlocale  (void);
 
+/* Translate a Win32 error code (as returned by GetLastError()) into
+ * the corresponding message. The returned string should be deallocated
+ * with g_free().
+ */
+gchar *         g_win32_error_message (gint error);
+
 #endif  /* G_OS_WIN32 */
 
 
@@ -3040,24 +3074,22 @@ void g_static_private_set_for_thread (GStaticPrivate *private_key,
                                      GThread        *thread,
                                      gpointer        data,
                                      GDestroyNotify  notify);
-#ifndef G_STATIC_REC_MUTEX_INIT
-/* if GStaticRecMutex is not just a differently initialized GStaticMutex, 
- * the following is done:
- * This can't be done in glibconfig.h, as GStaticPrivate and gboolean
- * are not yet known there 
- */
+
 typedef struct _GStaticRecMutex GStaticRecMutex;
 struct _GStaticRecMutex
 {
   GStaticMutex mutex;
-  GStaticPrivate counter; 
+  unsigned int depth;
+  GSystemThread owner;
 };
-#define G_STATIC_REC_MUTEX_INIT { G_STATIC_MUTEX_INIT, G_STATIC_PRIVATE_INIT }
-void     g_static_rec_mutex_lock    (GStaticRecMutex* mutex);
-gboolean g_static_rec_mutex_trylock (GStaticRecMutex* mutex);
-void     g_static_rec_mutex_unlock  (GStaticRecMutex* mutex);
-#define  g_static_rec_mutex_get_mutex(mutex) ((mutex)->mutex)
-#endif /* G_STATIC_REC_MUTEX_INIT */
+
+#define G_STATIC_REC_MUTEX_INIT { G_STATIC_MUTEX_INIT }
+void     g_static_rec_mutex_lock        (GStaticRecMutex *mutex);
+gboolean g_static_rec_mutex_trylock     (GStaticRecMutex *mutex);
+void     g_static_rec_mutex_unlock      (GStaticRecMutex *mutex);
+void     g_static_rec_mutex_lock_full   (GStaticRecMutex *mutex,
+                                        guint            depth);
+guint    g_static_rec_mutex_unlock_full (GStaticRecMutex *mutex);
 
 typedef struct _GStaticRWLock GStaticRWLock;
 struct _GStaticRWLock