+2008-11-24 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ Patch by: Simon Holm Thøgersen <odie at cs dot aau dot dk>
+
+ * gst/gstregistry.c: (gst_registry_scan_path_level):
+ Reduce the number of stat() calls for every file from three times
+ to one time. Fixes bug #560360.
+
2008-11-22 Wim Taymans <wim.taymans@collabora.co.uk>
* libs/gst/base/gstbasetransform.c:
#include <stdio.h>
#include <string.h>
+/* For g_stat () */
+#include <glib/gstdio.h>
#include "gstinfo.h"
#include "gstregistry.h"
return FALSE;
while ((dirent = g_dir_read_name (dir))) {
+ struct stat file_status;
+
filename = g_strjoin ("/", path, dirent, NULL);
+ if (g_stat (filename, &file_status) < 0) {
+ /* Plugin will be removed from cache after the scan completes if it
+ * is still marked 'cached' */
+ g_free (filename);
+ continue;
+ }
- if (g_file_test (filename, G_FILE_TEST_IS_DIR)) {
+ if (file_status.st_mode & S_IFDIR) {
/* skip the .debug directory, these contain elf files that are not
* useful or worse, can crash dlopen () */
if (g_str_equal (dirent, ".debug")) {
g_free (filename);
continue;
}
- if (!g_file_test (filename, G_FILE_TEST_IS_REGULAR)) {
+ if (!(file_status.st_mode & S_IFREG)) {
GST_LOG_OBJECT (registry, "%s is not a regular file, ignoring", filename);
g_free (filename);
continue;
* was already seen by the registry, we ignore it */
plugin = gst_registry_lookup (registry, filename);
if (plugin) {
- struct stat file_status;
-
- if (stat (filename, &file_status)) {
- /* Plugin will be removed from cache after the scan completes if it
- * is still marked 'cached' */
- g_free (filename);
- gst_object_unref (plugin);
- continue;
- }
if (plugin->registered) {
GST_DEBUG_OBJECT (registry,
"plugin already registered from path \"%s\"",