[seed] Remove some deprecated usage of Seed.import_namespace in hardcoded strings that could trigger readli



commit baf8914fbfeb4c4de05d694c107820cfb398a372
Author: Robert Carr <racarr mireia (none)>
Date:   Mon Apr 13 21:59:02 2009 -0400

    Remove some deprecated usage of Seed.import_namespace in hardcoded strings that could trigger readline module to be imported twice
---
 libseed/seed-engine.c |   12 +++++-------
 src/main.c            |    8 ++++----
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/libseed/seed-engine.c b/libseed/seed-engine.c
index d320922..2ef73f3 100644
--- a/libseed/seed-engine.c
+++ b/libseed/seed-engine.c
@@ -1349,7 +1349,7 @@ seed_repl_expose (JSContextRef ctx, ...)
 
   seed_object_set_property (ctx, seed, "debug_argv", arrayObj);
 
-  script = JSStringCreateWithUTF8CString ("Seed.import_namespace('readline');"
+  script = JSStringCreateWithUTF8CString ("readline = imports.readline;"
 					  "while(1) { try { Seed.print(eval("
 					  "readline.readline(\"> \"))); } catch(e) {"
 					  "Seed.print(e.name + \" \" + e.message);}}");
@@ -1523,12 +1523,10 @@ seed_init (gint * argc, gchar *** argv)
   seed_gtype_init (eng);
 
   defaults_script =
-    JSStringCreateWithUTF8CString ("Seed.import_namespace(\""
-				   "GObject\");"
-				   "try{Seed.include(\"/usr/share/"
-				   "seed/extensions/Seed.js\");} catch(e){}"
-				   "Seed.include(\"/usr/local/share"
-				   "/seed/extensions/Seed.js\");");
+	  JSStringCreateWithUTF8CString ("try{Seed.include(\"/usr/share/"
+					 "seed/extensions/Seed.js\");} catch(e){}"
+					 "Seed.include(\"/usr/local/share"
+					 "/seed/extensions/Seed.js\");");
   JSEvaluateScript (eng->context, defaults_script, NULL, NULL, 0, NULL);
   JSStringRelease (defaults_script);
 
diff --git a/src/main.c b/src/main.c
index cd6ba4b..86c4f0e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -35,10 +35,10 @@ seed_repl (gint argc, gchar ** argv)
 
   script =
     seed_make_script (eng->context,
-		      "Seed.import_namespace('readline');"
-		      "while(1) { try { Seed.print(eval("
-		      "readline.readline(\"> \"))); } catch(e) {"
-		      "Seed.print(e.name + \" \" + e.message);}}", NULL, 0);
+					  "readline = imports.readline"
+					  "while(1) { try { Seed.print(eval("
+					  "readline.readline(\"> \"))); } catch(e) {"
+					  "Seed.print(e.name + \" \" + e.message);}}", NULL, 0);
   seed_evaluate (eng->context, script, 0);
 
   g_free (script);



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