Commit 4f039bd4 authored by Alexander Larsson's avatar Alexander Larsson Committed by Alexander Larsson

Fix warnings

2007-12-05  Alexander Larsson  <alexl@redhat.com>

        * gdatainputstream.c:
	Fix warnings
	
        * gio.symbols:
        * giomodule.[ch]
        * glocaldirectorymonitor.c:
        * glocalfilemonitor.c:
        * gunionvolumemonitor.c:
        * gvfs.c:
	Make g_io_modules_ensure_loaded a private function and
	don't pass in the dirname. This means we can do magic
	directory finding in the win32 version.
	Export the actual load-modules-in-directory code so that
	gvfs can reuse that.


svn path=/trunk/; revision=6050
parent 510d4ec6
2007-12-05 Alexander Larsson <alexl@redhat.com>
* gdatainputstream.c:
Fix warnings
* gio.symbols:
* giomodule.[ch]
* glocaldirectorymonitor.c:
* glocalfilemonitor.c:
* gunionvolumemonitor.c:
* gvfs.c:
Make g_io_modules_ensure_loaded a private function and
don't pass in the dirname. This means we can do magic
directory finding in the win32 version.
Export the actual load-modules-in-directory code so that
gvfs can reuse that.
2007-12-05 Alexander Larsson <alexl@redhat.com>
* gbufferedinputstream.c:
......
......@@ -650,7 +650,7 @@ scan_for_newline (GDataInputStream *stream,
newline_len = 0;
start = checked;
buffer = (guint8*)g_buffered_input_stream_peek_buffer (bstream, &available) + start;
buffer = (const char*)g_buffered_input_stream_peek_buffer (bstream, &available) + start;
end = available;
peeked = end - start;
......@@ -826,7 +826,7 @@ scan_for_chars (GDataInputStream *stream,
found_pos = -1;
start = checked;
buffer = (guint8*)g_buffered_input_stream_peek_buffer (bstream, &available) + start;
buffer = (const char *)g_buffered_input_stream_peek_buffer (bstream, &available) + start;
end = available;
peeked = end - start;
......
......@@ -499,7 +499,7 @@ g_io_error_from_errno
#if IN_FILE(__G_IO_MODULE_C__)
g_io_module_get_type G_GNUC_CONST
g_io_module_new
g_io_modules_ensure_loaded
g_io_modules_load_all_in_directory
#endif
#endif
......
......@@ -23,6 +23,7 @@
#include <config.h>
#include "giomodule.h"
#include "giomodule-priv.h"
#include "gioalias.h"
......@@ -31,7 +32,8 @@
* @short_description: Loadable GIO Modules
*
* Provides an interface and default functions for loading and unloading
* GIO modules.
* modules. This is used internally to make gio extensible, but can also
* be used by other to implement module loading.
*
**/
......@@ -139,9 +141,10 @@ g_io_module_unload_module (GTypeModule *gmodule)
/**
* g_io_module_new:
* @filename: filename of the module to load.
* @filename: filename of the shared library module.
*
* Loads a new module into GIO.
* Creates a new GIOModule that will load the specific
* shared library when in use.
*
* Returns: a #GIOModule from given @filename,
* or %NULL on error.
......@@ -171,8 +174,16 @@ is_valid_module_name (const gchar *basename)
#endif
}
static GList *
load_modules (const char *dirname)
/**
* g_io_modules_load_all_in_directory:
* @dirname: pathname for a directory containing modules to load.
*
* Loads all the modules in the the specified directory.
*
* Returns: a list of #GIOModules loaded from the directory
**/
GList *
g_io_modules_load_all_in_directory (const char *dirname)
{
const gchar *name;
GDir *dir;
......@@ -218,33 +229,21 @@ load_modules (const char *dirname)
}
G_LOCK_DEFINE_STATIC (loaded_dirs);
static GHashTable *loaded_dirs = NULL;
/**
* g_io_modules_ensure_loaded:
* @directory: string containing a directory path.
*
* Loads all of the modules within the @directory.
**/
void
g_io_modules_ensure_loaded (const char *directory)
_g_io_modules_ensure_loaded (void)
{
GList *modules;
const char *directory;
static gboolean loaded_dirs = FALSE;
g_return_if_fail (directory != NULL);
G_LOCK (loaded_dirs);
if (loaded_dirs == NULL)
loaded_dirs = g_hash_table_new (g_str_hash, g_str_equal);
if (!g_hash_table_lookup_extended (loaded_dirs, directory,
NULL, NULL))
if (!loaded_dirs)
{
modules = load_modules (directory);
g_hash_table_insert (loaded_dirs,
g_strdup (directory),
modules);
loaded_dirs = TRUE;
modules = g_io_modules_load_all_in_directory (GIO_MODULE_DIR);
}
G_UNLOCK (loaded_dirs);
......
......@@ -46,7 +46,7 @@ typedef struct _GIOModuleClass GIOModuleClass;
GType g_io_module_get_type (void) G_GNUC_CONST;
GIOModule *g_io_module_new (const gchar *filename);
void g_io_modules_ensure_loaded (const char *directory);
GList * g_io_modules_load_all_in_directory (const char *dirname);
/* API for the modules to implement */
/**
......
......@@ -222,7 +222,7 @@ get_default_local_directory_monitor (gpointer data)
_g_inotify_directory_monitor_get_type ();
#endif
g_io_modules_ensure_loaded (GIO_MODULE_DIR);
_g_io_modules_ensure_loaded ();
monitor_impls = g_type_children (G_TYPE_LOCAL_DIRECTORY_MONITOR,
&n_monitor_impls);
......
......@@ -158,7 +158,7 @@ get_default_local_file_monitor (gpointer data)
_g_inotify_file_monitor_get_type ();
#endif
g_io_modules_ensure_loaded (GIO_MODULE_DIR);
_g_io_modules_ensure_loaded ();
monitor_impls = g_type_children (G_TYPE_LOCAL_FILE_MONITOR,
&n_monitor_impls);
......
......@@ -259,7 +259,7 @@ get_default_native_type (gpointer data)
#endif
/* Ensure vfs in modules loaded */
g_io_modules_ensure_loaded (GIO_MODULE_DIR);
_g_io_modules_ensure_loaded ();
monitors = g_type_children (G_TYPE_NATIVE_VOLUME_MONITOR, &n_monitors);
native_type = 0;
......
......@@ -220,7 +220,7 @@ get_default_vfs (gpointer arg)
local_type = casted_get_type ();
/* Ensure vfs in modules loaded */
g_io_modules_ensure_loaded (GIO_MODULE_DIR);
_g_io_modules_ensure_loaded ();
vfs_impls = g_type_children (G_TYPE_VFS, &n_vfs_impls);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment