registry: use GStatBuf unconditionally and add typedef for backwards compatibility

No need to clutter the code with #if #else #endif.

See #623875.
This commit is contained in:
Tim-Philipp Müller 2010-07-16 17:53:38 +01:00
parent 88ec06f433
commit b987febf09
4 changed files with 6 additions and 28 deletions

View file

@ -10,6 +10,10 @@
G_BEGIN_DECLS
#if !GLIB_CHECK_VERSION(2,25,0)
typedef struct stat GStatBuf;
#endif
/* copies */
/* adaptations */

View file

@ -670,11 +670,7 @@ gst_plugin_load_file (const gchar * filename, GError ** error)
GModule *module;
gboolean ret;
gpointer ptr;
#if GLIB_CHECK_VERSION(2,25,0)
GStatBuf file_status;
#else
struct stat file_status;
#endif
GstRegistry *registry;
gboolean new_plugin = TRUE;
@ -1470,13 +1466,7 @@ gst_plugin_ext_dep_extract_env_vars_paths (GstPlugin * plugin,
}
static guint
gst_plugin_ext_dep_get_hash_from_stat_entry (
#if GLIB_CHECK_VERSION(2,25,0)
GStatBuf * s
#else
struct stat *s
#endif
)
gst_plugin_ext_dep_get_hash_from_stat_entry (GStatBuf * s)
{
if (!(s->st_mode & (S_IFDIR | S_IFREG)))
return (guint) - 1;
@ -1533,11 +1523,7 @@ gst_plugin_ext_dep_scan_dir_and_match_names (GstPlugin * plugin,
* the same order, and not in a random order */
while ((entry = g_dir_read_name (dir))) {
gboolean have_match;
#if GLIB_CHECK_VERSION(2,25,0)
GStatBuf s;
#else
struct stat s;
#endif
gchar *full_path;
guint fhash;
@ -1594,12 +1580,7 @@ gst_plugin_ext_dep_scan_path_with_filenames (GstPlugin * plugin,
* and going through each entry to see if it matches one of our filenames. */
if (!recurse_into_dirs && !partial_names) {
for (i = 0; filenames[i] != NULL; ++i) {
#if GLIB_CHECK_VERSION(2,25,0)
GStatBuf s;
#else
struct stat s;
#endif
gchar *full_path;
guint fhash;

View file

@ -135,6 +135,7 @@
#include "gst-i18n-lib.h"
#include "gst.h"
#include "glib-compat-private.h"
#ifdef G_OS_WIN32
#include <windows.h>
@ -1106,11 +1107,7 @@ gst_registry_scan_path_level (GstRegistryScanContext * context,
return FALSE;
while ((dirent = g_dir_read_name (dir))) {
#if GLIB_CHECK_VERSION(2,25,0)
GStatBuf file_status;
#else
struct stat file_status;
#endif
filename = g_build_filename (path, dirent, NULL);
if (g_stat (filename, &file_status) < 0) {

View file

@ -363,11 +363,7 @@ gst_registry_binary_write_cache (GstRegistry * registry, const char *location)
continue;
if (plugin->flags & GST_PLUGIN_FLAG_CACHED) {
#if GLIB_CHECK_VERSION(2,25,0)
GStatBuf statbuf;
#else
struct stat statbuf;
#endif
if (g_stat (plugin->filename, &statbuf) < 0 ||
plugin->file_mtime != statbuf.st_mtime ||