[glib: 1/2] Revert "Don't compile some unused functions in gio/xdgmime/"




commit 3dcae415a431a79e4eefd0225bc79c1024beb384
Author: Philip Withnall <pwithnall endlessos org>
Date:   Tue Sep 28 15:40:21 2021 +0100

    Revert "Don't compile some unused functions in gio/xdgmime/"
    
    This reverts commit 14e46ca288912a6155ddfa3c6d08b49848f59ec0.
    
    Diverging from upstream xdgmime is a maintenance burden, and this
    isn’t really much additional code to compile. It should be dropped by
    the linker since it’s unused.
    
    See https://gitlab.freedesktop.org/xdg/xdgmime/-/merge_requests/15.

 gio/xdgmime/xdgmime.c       | 22 +---------------------
 gio/xdgmime/xdgmime.h       | 14 ++------------
 gio/xdgmime/xdgmimealias.c  |  4 +---
 gio/xdgmime/xdgmimealias.h  |  3 +--
 gio/xdgmime/xdgmimecache.c  |  8 +-------
 gio/xdgmime/xdgmimecache.h  |  6 ------
 gio/xdgmime/xdgmimeglob.c   |  7 -------
 gio/xdgmime/xdgmimeglob.h   |  2 --
 gio/xdgmime/xdgmimeicon.c   |  2 --
 gio/xdgmime/xdgmimeicon.h   |  2 --
 gio/xdgmime/xdgmimeparent.c |  2 --
 gio/xdgmime/xdgmimeparent.h |  2 --
 12 files changed, 6 insertions(+), 68 deletions(-)
---
diff --git a/gio/xdgmime/xdgmime.c b/gio/xdgmime/xdgmime.c
index 770a4dd0b..72264da0f 100644
--- a/gio/xdgmime/xdgmime.c
+++ b/gio/xdgmime/xdgmime.c
@@ -553,8 +553,6 @@ xdg_mime_get_mime_type_for_data (const void *data,
   return _xdg_binary_or_text_fallback(data, len);
 }
 
-#ifdef NOT_USED_IN_GIO
-
 const char *
 xdg_mime_get_mime_type_for_file (const char  *file_name,
                                  struct stat *statbuf)
@@ -650,8 +648,6 @@ xdg_mime_get_mime_type_from_file_name (const char *file_name)
     return XDG_MIME_TYPE_UNKNOWN;
 }
 
-#endif
-
 int
 xdg_mime_get_mime_types_from_file_name (const char *file_name,
                                        const char  *mime_types[],
@@ -665,8 +661,6 @@ xdg_mime_get_mime_types_from_file_name (const char *file_name,
   return _xdg_glob_hash_lookup_file_name (global_hash, file_name, mime_types, n_mime_types);
 }
 
-#ifdef NOT_USED_IN_GIO
-
 int
 xdg_mime_is_valid_mime_type (const char *mime_type)
 {
@@ -675,8 +669,6 @@ xdg_mime_is_valid_mime_type (const char *mime_type)
   return _xdg_utf8_validate (mime_type);
 }
 
-#endif
-
 void
 xdg_mime_shutdown (void)
 {
@@ -892,19 +884,14 @@ xdg_mime_mime_type_subclass (const char *mime,
 char **
 xdg_mime_list_mime_parents (const char *mime)
 {
-  const char *umime;
   const char **parents;
   char **result;
   int i, n;
 
-  xdg_mime_init ();
-
   if (_caches)
     return _xdg_mime_cache_list_mime_parents (mime);
 
-  umime = _xdg_mime_unalias_mime_type (mime);
-
-  parents = _xdg_mime_parent_list_lookup (parent_list, umime);
+  parents = xdg_mime_get_mime_parents (mime);
 
   if (!parents)
     return NULL;
@@ -918,8 +905,6 @@ xdg_mime_list_mime_parents (const char *mime)
   return result;
 }
 
-#ifdef NOT_USED_IN_GIO
-
 const char **
 xdg_mime_get_mime_parents (const char *mime)
 {
@@ -949,7 +934,6 @@ xdg_mime_dump (void)
   _xdg_mime_cache_glob_dump ();
 }
 
-#endif
 
 /* Registers a function to be called every time the mime database reloads its files
  */
@@ -977,8 +961,6 @@ xdg_mime_register_reload_callback (XdgMimeCallback  callback,
   return callback_id - 1;
 }
 
-#ifdef NOT_USED_IN_GIO
-
 void
 xdg_mime_remove_callback (int callback_id)
 {
@@ -1004,8 +986,6 @@ xdg_mime_remove_callback (int callback_id)
     }
 }
 
-#endif
-
 const char *
 xdg_mime_get_icon (const char *mime)
 {
diff --git a/gio/xdgmime/xdgmime.h b/gio/xdgmime/xdgmime.h
index 92dbc3422..c5909967f 100644
--- a/gio/xdgmime/xdgmime.h
+++ b/gio/xdgmime/xdgmime.h
@@ -73,9 +73,9 @@ typedef void (*XdgMimeDestroy)  (void *user_data);
 #define xdg_mime_get_icon                     XDG_ENTRY(get_icon)
 #define xdg_mime_get_generic_icon             XDG_ENTRY(get_generic_icon)
 
-#define _xdg_mime_mime_type_subclass          XDG_RESERVED_ENTRY(mime_type_subclass)
 #define _xdg_mime_mime_type_equal             XDG_RESERVED_ENTRY(mime_type_equal)
-#define _xdg_mime_unalias_mime_type           XDG_RESERVED_ENTRY(unalias_mime_type)
+#define _xdg_mime_mime_type_subclass          XDG_RESERVED_ENTRY(mime_type_subclass)
+#define _xdg_mime_unalias_mime_type           XDG_RESERVED_ENTRY(unalias_mime_type)  
 #endif
 
 extern const char xdg_mime_type_unknown[];
@@ -88,17 +88,13 @@ extern const char xdg_mime_type_textplain[];
 const char  *xdg_mime_get_mime_type_for_data       (const void *data,
                                                    size_t      len,
                                                    int        *result_prio);
-#ifdef NOT_USED_IN_GIO
 const char  *xdg_mime_get_mime_type_for_file       (const char *file_name,
                                                     struct stat *statbuf);
 const char  *xdg_mime_get_mime_type_from_file_name (const char *file_name);
-#endif
 int          xdg_mime_get_mime_types_from_file_name(const char *file_name,
                                                    const char *mime_types[],
                                                    int         n_mime_types);
-#ifdef NOT_USED_IN_GIO
 int          xdg_mime_is_valid_mime_type           (const char *mime_type);
-#endif
 int          xdg_mime_mime_type_equal              (const char *mime_a,
                                                    const char *mime_b);
 int          xdg_mime_media_type_equal             (const char *mime_a,
@@ -110,24 +106,18 @@ int          xdg_mime_mime_type_subclass           (const char *mime_a,
    * instead, but notice that that function expects you to free
    * the array it returns. 
    */
-#ifdef NOT_USED_IN_GIO
 const char **xdg_mime_get_mime_parents            (const char *mime);
-#endif
 char **      xdg_mime_list_mime_parents                   (const char *mime);
 const char  *xdg_mime_unalias_mime_type                   (const char *mime);
 const char  *xdg_mime_get_icon                     (const char *mime);
 const char  *xdg_mime_get_generic_icon             (const char *mime);
 int          xdg_mime_get_max_buffer_extents       (void);
 void         xdg_mime_shutdown                     (void);
-#ifdef NOT_USED_IN_GIO
 void         xdg_mime_dump                         (void);
-#endif
 int          xdg_mime_register_reload_callback     (XdgMimeCallback  callback,
                                                    void            *data,
                                                    XdgMimeDestroy   destroy);
-#ifdef NOT_USED_IN_GIO
 void         xdg_mime_remove_callback              (int              callback_id);
-#endif
 
 void xdg_mime_set_dirs (const char * const *dirs);
 
diff --git a/gio/xdgmime/xdgmimealias.c b/gio/xdgmime/xdgmimealias.c
index 265191aab..0fc51f94c 100644
--- a/gio/xdgmime/xdgmimealias.c
+++ b/gio/xdgmime/xdgmimealias.c
@@ -165,8 +165,6 @@ _xdg_mime_alias_read_from_file (XdgAliasList *list,
 }
 
 
-#ifdef NOT_USED_IN_GIO
-
 void
 _xdg_mime_alias_list_dump (XdgAliasList *list)
 {
@@ -183,4 +181,4 @@ _xdg_mime_alias_list_dump (XdgAliasList *list)
     }
 }
 
-#endif
+
diff --git a/gio/xdgmime/xdgmimealias.h b/gio/xdgmime/xdgmimealias.h
index 2178b8b48..6e0cfff3b 100644
--- a/gio/xdgmime/xdgmimealias.h
+++ b/gio/xdgmime/xdgmimealias.h
@@ -46,7 +46,6 @@ XdgAliasList *_xdg_mime_alias_list_new       (void);
 void          _xdg_mime_alias_list_free      (XdgAliasList *list);
 const char   *_xdg_mime_alias_list_lookup    (XdgAliasList *list,
                                              const char  *alias);
-#ifdef NOT_USED_IN_GIO
 void          _xdg_mime_alias_list_dump      (XdgAliasList *list);
-#endif
+
 #endif /* __XDG_MIME_ALIAS_H__ */
diff --git a/gio/xdgmime/xdgmimecache.c b/gio/xdgmime/xdgmimecache.c
index 3818180ae..c89349e08 100644
--- a/gio/xdgmime/xdgmimecache.c
+++ b/gio/xdgmime/xdgmimecache.c
@@ -775,8 +775,6 @@ _xdg_mime_cache_get_mime_type_for_data (const void *data,
   return cache_get_mime_type_for_data (data, len, result_prio, NULL, 0);
 }
 
-#ifdef NOT_USED_IN_GIO
-
 const char *
 _xdg_mime_cache_get_mime_type_for_file (const char  *file_name,
                                        struct stat *statbuf)
@@ -863,8 +861,6 @@ _xdg_mime_cache_get_mime_type_from_file_name (const char *file_name)
     return XDG_MIME_TYPE_UNKNOWN;
 }
 
-#endif
-
 int
 _xdg_mime_cache_get_mime_types_from_file_name (const char *file_name,
                                               const char  *mime_types[],
@@ -1111,8 +1107,6 @@ _xdg_mime_cache_get_icon (const char *mime)
   return cache_lookup_icon (mime, 32);
 }
 
-#ifdef NOT_USED_IN_GIO
-
 static void
 dump_glob_node (XdgMimeCache *cache,
                xdg_uint32_t  offset,
@@ -1164,4 +1158,4 @@ _xdg_mime_cache_glob_dump (void)
   }
 }
 
-#endif
+
diff --git a/gio/xdgmime/xdgmimecache.h b/gio/xdgmime/xdgmimecache.h
index fdce80f64..df25b2a57 100644
--- a/gio/xdgmime/xdgmimecache.h
+++ b/gio/xdgmime/xdgmimecache.h
@@ -58,16 +58,12 @@ void          _xdg_mime_cache_unref         (XdgMimeCache *cache);
 const char  *_xdg_mime_cache_get_mime_type_for_data       (const void *data,
                                                           size_t      len,
                                                           int        *result_prio);
-#ifdef NOT_USED_IN_GIO
 const char  *_xdg_mime_cache_get_mime_type_for_file       (const char  *file_name,
                                                           struct stat *statbuf);
-#endif
 int          _xdg_mime_cache_get_mime_types_from_file_name (const char *file_name,
                                                            const char  *mime_types[],
                                                            int          n_mime_types);
-#ifdef NOT_USED_IN_GIO
 const char  *_xdg_mime_cache_get_mime_type_from_file_name (const char *file_name);
-#endif
 int          _xdg_mime_cache_is_valid_mime_type           (const char *mime_type);
 int          _xdg_mime_cache_mime_type_equal              (const char *mime_a,
                                                           const char *mime_b);
@@ -80,8 +76,6 @@ const char  *_xdg_mime_cache_unalias_mime_type            (const char *mime);
 int          _xdg_mime_cache_get_max_buffer_extents       (void);
 const char  *_xdg_mime_cache_get_icon                     (const char *mime);
 const char  *_xdg_mime_cache_get_generic_icon             (const char *mime);
-#ifdef NOT_USED_IN_GIO
 void         _xdg_mime_cache_glob_dump                    (void);
-#endif
 
 #endif /* __XDG_MIME_CACHE_H__ */
diff --git a/gio/xdgmime/xdgmimeglob.c b/gio/xdgmime/xdgmimeglob.c
index a4c80c51d..d68435c89 100644
--- a/gio/xdgmime/xdgmimeglob.c
+++ b/gio/xdgmime/xdgmimeglob.c
@@ -162,8 +162,6 @@ _xdg_glob_hash_node_new (void)
   return glob_hash_node;
 }
 
-#ifdef NOT_USED_IN_GIO
-
 static void
 _xdg_glob_hash_node_dump (XdgGlobHashNode *glob_hash_node,
                          int depth)
@@ -183,8 +181,6 @@ _xdg_glob_hash_node_dump (XdgGlobHashNode *glob_hash_node,
     _xdg_glob_hash_node_dump (glob_hash_node->next, depth);
 }
 
-#endif
-
 static XdgGlobHashNode *
 _xdg_glob_hash_insert_ucs4 (XdgGlobHashNode *glob_hash_node,
                            xdg_unichar_t   *text,
@@ -607,8 +603,6 @@ _xdg_glob_hash_append_glob (XdgGlobHash *glob_hash,
     }
 }
 
-#ifdef NOT_USED_IN_GIO
-
 void
 _xdg_glob_hash_dump (XdgGlobHash *glob_hash)
 {
@@ -645,7 +639,6 @@ _xdg_glob_hash_dump (XdgGlobHash *glob_hash)
     }
 }
 
-#endif
 
 void
 _xdg_mime_glob_read_from_file (XdgGlobHash *glob_hash,
diff --git a/gio/xdgmime/xdgmimeglob.h b/gio/xdgmime/xdgmimeglob.h
index 523e5f242..8b1fa3ad4 100644
--- a/gio/xdgmime/xdgmimeglob.h
+++ b/gio/xdgmime/xdgmimeglob.h
@@ -65,8 +65,6 @@ void         _xdg_glob_hash_append_glob      (XdgGlobHash *glob_hash,
                                              int          weight,
                                              int          case_sensitive);
 XdgGlobType  _xdg_glob_determine_type        (const char  *glob);
-#ifdef NOT_USED_IN_GIO
 void         _xdg_glob_hash_dump             (XdgGlobHash *glob_hash);
-#endif
 
 #endif /* __XDG_MIME_GLOB_H__ */
diff --git a/gio/xdgmime/xdgmimeicon.c b/gio/xdgmime/xdgmimeicon.c
index 715832231..feb6c869c 100644
--- a/gio/xdgmime/xdgmimeicon.c
+++ b/gio/xdgmime/xdgmimeicon.c
@@ -163,7 +163,6 @@ _xdg_mime_icon_read_from_file (XdgIconList *list,
            sizeof (XdgIcon), icon_entry_cmp);
 }
 
-#ifdef NOT_USED_IN_GIO
 
 void
 _xdg_mime_icon_list_dump (XdgIconList *list)
@@ -181,5 +180,4 @@ _xdg_mime_icon_list_dump (XdgIconList *list)
     }
 }
 
-#endif
 
diff --git a/gio/xdgmime/xdgmimeicon.h b/gio/xdgmime/xdgmimeicon.h
index 1718cb4c0..c416b3c5e 100644
--- a/gio/xdgmime/xdgmimeicon.h
+++ b/gio/xdgmime/xdgmimeicon.h
@@ -45,8 +45,6 @@ XdgIconList  *_xdg_mime_icon_list_new       (void);
 void          _xdg_mime_icon_list_free      (XdgIconList *list);
 const char   *_xdg_mime_icon_list_lookup    (XdgIconList *list,
                                             const char  *mime);
-#ifdef NOT_USED_IN_GIO
 void          _xdg_mime_icon_list_dump      (XdgIconList *list);
-#endif
 
 #endif /* __XDG_MIME_ICON_H__ */
diff --git a/gio/xdgmime/xdgmimeparent.c b/gio/xdgmime/xdgmimeparent.c
index c636f4a9c..89b48fc16 100644
--- a/gio/xdgmime/xdgmimeparent.c
+++ b/gio/xdgmime/xdgmimeparent.c
@@ -200,7 +200,6 @@ _xdg_mime_parent_read_from_file (XdgParentList *list,
            sizeof (XdgMimeParents), &parent_entry_cmp);
 }
 
-#ifdef NOT_USED_IN_GIO
 
 void         
 _xdg_mime_parent_list_dump (XdgParentList *list)
@@ -218,5 +217,4 @@ _xdg_mime_parent_list_dump (XdgParentList *list)
     }
 }
 
-#endif
 
diff --git a/gio/xdgmime/xdgmimeparent.h b/gio/xdgmime/xdgmimeparent.h
index a95533e15..29f43bc1f 100644
--- a/gio/xdgmime/xdgmimeparent.h
+++ b/gio/xdgmime/xdgmimeparent.h
@@ -46,8 +46,6 @@ XdgParentList *_xdg_mime_parent_list_new       (void);
 void           _xdg_mime_parent_list_free      (XdgParentList *list);
 const char   **_xdg_mime_parent_list_lookup    (XdgParentList *list,
                                                const char    *mime);
-#ifdef NOT_USED_IN_GIO
 void           _xdg_mime_parent_list_dump      (XdgParentList *list);
-#endif
 
 #endif /* __XDG_MIME_PARENT_H__ */


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