[gjs] Don't repeatedly try to load built-in modules



commit b92ba1bff7eef86c679a1b248aa1d7f66a5bb739
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Sat Nov 20 13:22:01 2010 -0500

    Don't repeatedly try to load built-in modules
    
    There's no point in trying to load a built-in module once per every
    item in the search path; once is sufficient.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=635371

 gjs/importer.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/gjs/importer.c b/gjs/importer.c
index b0a921f..4057e64 100644
--- a/gjs/importer.c
+++ b/gjs/importer.c
@@ -514,6 +514,14 @@ do_import(JSContext  *context,
     full_path = NULL;
     directories = NULL;
 
+    /* First try importing an internal module like byteArray */
+    if (import_native_file(context, obj, name, NULL)) {
+        gjs_debug(GJS_DEBUG_IMPORTER,
+                  "successfully imported module '%s'", name);
+        result = JS_TRUE;
+        goto out;
+    }
+
     for (i = 0; i < search_path_len; ++i) {
         jsval elem;
 
@@ -564,14 +572,6 @@ do_import(JSContext  *context,
             }
         }
 
-        /* First try importing an internal module like byteArray */
-        if (import_native_file(context, obj, name, NULL)) {
-            gjs_debug(GJS_DEBUG_IMPORTER,
-                      "successfully imported module '%s'", name);
-            result = JS_TRUE;
-            goto out;
-        }
-
         /* Second try importing a directory (a sub-importer) */
         if (full_path)
             g_free(full_path);



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