[seed] Bug #778310 - Constify string parameters



commit 70325ae64639f2731ded21f1c28589ec57f6859c
Author: Emanuele Aina <emanuele aina collabora com>
Date:   Wed Feb 8 11:44:50 2017 +0800

    Bug #778310 -  Constify string parameters

 libseed/seed-api.c      |    2 +-
 libseed/seed-engine.c   |    6 +++---
 libseed/seed-engine.h   |    4 ++--
 libseed/seed-importer.c |    8 ++++----
 libseed/seed-importer.h |    2 +-
 libseed/seed-structs.c  |    4 ++--
 libseed/seed-structs.h  |    4 ++--
 libseed/seed.h          |   10 +++++-----
 8 files changed, 20 insertions(+), 20 deletions(-)
---
diff --git a/libseed/seed-api.c b/libseed/seed-api.c
index c35c050..6acbe1b 100644
--- a/libseed/seed-api.c
+++ b/libseed/seed-api.c
@@ -246,7 +246,7 @@ seed_make_script(JSContextRef ctx,
  *
  */
 SeedScript*
-seed_script_new_from_file(JSContextRef ctx, gchar* file)
+seed_script_new_from_file(JSContextRef ctx, const gchar* file)
 {
     SeedScript* script;
     GError* e = NULL;
diff --git a/libseed/seed-engine.c b/libseed/seed-engine.c
index 5a8df7d..fd52839 100644
--- a/libseed/seed-engine.c
+++ b/libseed/seed-engine.c
@@ -1617,7 +1617,7 @@ JSClassDefinition struct_constructor_def = {
  */
 void
 seed_create_function(JSContextRef ctx,
-                     gchar* name,
+                     const gchar* name,
                      gpointer func,
                      JSObjectRef obj)
 {
@@ -2055,9 +2055,9 @@ seed_engine_initialize_importer(SeedEngine *engine)
  */
 JSValueRef
 seed_engine_expose_gobject(SeedEngine* engine,
-                           gchar* js_name,
+                           const gchar* js_name,
                            GObject* object,
-                           gchar* gir_namespace,
+                           const gchar* gir_namespace,
                            JSValueRef* exception)
 {
     GError* error = NULL;
diff --git a/libseed/seed-engine.h b/libseed/seed-engine.h
index 0905420..ef3cedc 100644
--- a/libseed/seed-engine.h
+++ b/libseed/seed-engine.h
@@ -57,7 +57,7 @@ void seed_gobject_define_property_from_function_info(JSContextRef ctx,
                                                      JSObjectRef object,
                                                      gboolean instance);
 void seed_create_function(JSContextRef ctx,
-                          gchar* name,
+                          const gchar* name,
                           gpointer func,
                           JSObjectRef obj);
 
@@ -71,7 +71,7 @@ SeedScript* seed_make_script(JSContextRef ctx,
                              const gchar* js,
                              const gchar* source_url,
                              gint line_number);
-SeedScript* seed_script_new_from_file(JSContextRef ctx, gchar* file);
+SeedScript* seed_script_new_from_file(JSContextRef ctx, const gchar* file);
 JSValueRef seed_script_exception(SeedScript* s);
 
 JSValueRef seed_evaluate(JSContextRef ctx,
diff --git a/libseed/seed-importer.c b/libseed/seed-importer.c
index 8213735..81777ad 100644
--- a/libseed/seed-importer.c
+++ b/libseed/seed-importer.c
@@ -445,7 +445,7 @@ seed_gi_importer_handle_constant(JSContextRef ctx,
 
 static gchar*
 seed_gi_importer_get_version(JSContextRef ctx,
-                             gchar* namespace,
+                             const gchar* namespace,
                              JSValueRef* exception)
 {
     JSValueRef version_ref;
@@ -474,7 +474,7 @@ lookup_init_override(JSContextRef ctx, JSObjectRef module)
 
 JSObjectRef
 seed_gi_importer_do_namespace(JSContextRef ctx,
-                              gchar* namespace,
+                              const gchar* namespace,
                               JSValueRef* exception)
 {
     GIBaseInfo* info;
@@ -768,7 +768,7 @@ seed_importer_handle_native_module(JSContextRef ctx,
 }
 
 static gchar*
-seed_importer_canonicalize_path(gchar* path)
+seed_importer_canonicalize_path(const gchar* path)
 {
     GFile* file;
     gchar* absolute_path;
@@ -1045,7 +1045,7 @@ seed_importer_dir_finalize(JSObjectRef dir)
 }
 
 void
-seed_importer_add_global(JSObjectRef global, gchar* name)
+seed_importer_add_global(JSObjectRef global, const gchar* name)
 {
     JSValueProtect(eng->context, global);
     g_hash_table_insert(file_imports, seed_importer_canonicalize_path(name),
diff --git a/libseed/seed-importer.h b/libseed/seed-importer.h
index 9aa2309..cd50fd0 100644
--- a/libseed/seed-importer.h
+++ b/libseed/seed-importer.h
@@ -26,7 +26,7 @@ extern JSObjectRef importer;
 
 void seed_initialize_importer(JSContextRef ctx, JSObjectRef global);
 JSObjectRef seed_gi_importer_do_namespace(JSContextRef ctx,
-                                          gchar* namespace,
+                                          const gchar* namespace,
                                           JSValueRef* exception);
 
 gboolean seed_importer_get_file_contents(const gchar* filename,
diff --git a/libseed/seed-structs.c b/libseed/seed-structs.c
index 0982e36..4fa33eb 100644
--- a/libseed/seed-structs.c
+++ b/libseed/seed-structs.c
@@ -79,7 +79,7 @@ seed_boxed_finalize(JSObjectRef object)
 }
 
 GIFieldInfo*
-seed_union_find_field(GIUnionInfo* info, gchar* field_name)
+seed_union_find_field(GIUnionInfo* info, const gchar* field_name)
 {
     gint n, i;
     GIFieldInfo* field;
@@ -100,7 +100,7 @@ seed_union_find_field(GIUnionInfo* info, gchar* field_name)
 }
 
 GIFieldInfo*
-seed_struct_find_field(GIStructInfo* info, gchar* field_name)
+seed_struct_find_field(GIStructInfo* info, const gchar* field_name)
 {
     gint n, i;
     const gchar* name;
diff --git a/libseed/seed-structs.h b/libseed/seed-structs.h
index 33ad639..ac34018 100644
--- a/libseed/seed-structs.h
+++ b/libseed/seed-structs.h
@@ -41,8 +41,8 @@ void seed_pointer_set_free(JSContextRef ctx,
                            JSValueRef pointer,
                            gboolean free_pointer);
 
-GIFieldInfo* seed_struct_find_field(GIStructInfo* info, gchar* field_name);
-GIFieldInfo* seed_union_find_field(GIUnionInfo* info, gchar* field_name);
+GIFieldInfo* seed_struct_find_field(GIStructInfo* info, const gchar* field_name);
+GIFieldInfo* seed_union_find_field(GIUnionInfo* info, const gchar* field_name);
 
 JSObjectRef seed_construct_struct_type_with_parameters(JSContextRef ctx,
                                                        GIBaseInfo* info,
diff --git a/libseed/seed.h b/libseed/seed.h
index 42de00c..b7ac038 100644
--- a/libseed/seed.h
+++ b/libseed/seed.h
@@ -97,7 +97,7 @@ void seed_init_builtins(SeedEngine* local_eng, gint* argc, gchar*** argv);
 void seed_engine_destroy(SeedEngine* eng);
 
 SeedValue seed_simple_evaluate(SeedContext ctx,
-                               gchar* source,
+                               const gchar* source,
                                SeedException* exception);
 
 SeedScript* seed_make_script(SeedContext ctx,
@@ -124,12 +124,12 @@ SeedValue seed_evaluate(SeedContext ctx, SeedScript* s, SeedObject this_object);
 void seed_engine_initialize_importer(SeedEngine *engine);
 
 SeedValue seed_engine_expose_gobject(SeedEngine* engine,
-                                     gchar* js_name,
+                                     const gchar* js_name,
                                      GObject* object,
-                                     gchar* gir_namespace,
+                                     const gchar* gir_namespace,
                                      SeedException *exception);
 SeedValue seed_engine_expose_namespace(SeedEngine* engine,
-                                       gchar* namespace_name,
+                                       const gchar* namespace_name,
                                        SeedException *exception);
 GOptionGroup* seed_get_option_group(void);
 
@@ -145,7 +145,7 @@ void seed_context_collect(SeedGlobalContext ctx);
 
 SeedObject seed_context_get_global_object(SeedContext ctx);
 
-void seed_importer_add_global(SeedContext ctx, gchar* name);
+void seed_importer_add_global(SeedContext ctx, const gchar* name);
 void seed_importer_set_search_path(SeedContext ctx, gchar** search_path);
 void seed_prepare_global_context(SeedContext ctx);
 void seed_importer_add_search_path(SeedContext ctx, gchar* search_path);


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