[gjs/wip/ptomato/internals: 6/6] WIP - Remove unused API



commit b7c5e8ced5cef60a7d0a0e3299448bc6590ed2f1
Author: Philip Chimento <philip chimento gmail com>
Date:   Tue Oct 4 22:00:59 2016 -0700

    WIP - Remove unused API
    
    I'm not sure if we really want to remove all this, but this is what's
    unused. I'm putting it up here to see what people think of removing it.
    I haven't looked at the util/ directory yet.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=772386

 gi/arg.cpp              |    2 +-
 gi/arg.h                |    4 -
 gi/boxed.h              |    3 +-
 gi/enumeration.cpp      |   24 ------
 gi/enumeration.h        |    2 -
 gi/function.h           |    2 -
 gi/fundamental.cpp      |    8 --
 gi/fundamental.h        |    3 -
 gi/gtype.h              |    5 --
 gi/keep-alive.cpp       |    2 +-
 gi/keep-alive.h         |    1 -
 gi/repo.h               |    3 +-
 gjs/byteArray.cpp       |   25 -------
 gjs/byteArray.h         |    2 -
 gjs/coverage-internal.h |    2 -
 gjs/coverage.cpp        |    2 +-
 gjs/jsapi-util.cpp      |  179 +---------------------------------------------
 gjs/jsapi-util.h        |   33 +---------
 modules/console.cpp     |    2 +-
 modules/console.h       |    3 -
 20 files changed, 11 insertions(+), 296 deletions(-)
---
diff --git a/gi/arg.cpp b/gi/arg.cpp
index 47773a3..aaf4aed 100644
--- a/gi/arg.cpp
+++ b/gi/arg.cpp
@@ -79,7 +79,7 @@ _gjs_flags_value_is_valid(JSContext   *context,
     return true;
 }
 
-bool
+static bool
 _gjs_enum_value_is_valid(JSContext  *context,
                          GIEnumInfo *enum_info,
                          gint64      value)
diff --git a/gi/arg.h b/gi/arg.h
index ca6fdcf..801775c 100644
--- a/gi/arg.h
+++ b/gi/arg.h
@@ -101,10 +101,6 @@ bool _gjs_flags_value_is_valid (JSContext   *context,
                                 GType        gtype,
                                 gint64       value);
 
-bool _gjs_enum_value_is_valid (JSContext  *context,
-                               GIEnumInfo *enum_info,
-                               gint64      value);
-
 gint64 _gjs_enum_from_int (GIEnumInfo *enum_info,
                            int         int_value);
 
diff --git a/gi/boxed.h b/gi/boxed.h
index 698ed59..85b7791 100644
--- a/gi/boxed.h
+++ b/gi/boxed.h
@@ -44,8 +44,7 @@ typedef GIStructInfo GIBoxedInfo;
 void      gjs_define_boxed_class       (JSContext             *context,
                                         JSObject              *in_object,
                                         GIBoxedInfo           *info);
-JSObject* gjs_lookup_boxed_prototype   (JSContext             *context,
-                                        GIBoxedInfo           *info);
+
 void*     gjs_c_struct_from_boxed      (JSContext             *context,
                                         JS::HandleObject       obj);
 JSObject* gjs_boxed_from_c_struct      (JSContext             *context,
diff --git a/gi/enumeration.cpp b/gi/enumeration.cpp
index ac22160..ab05128 100644
--- a/gi/enumeration.cpp
+++ b/gi/enumeration.cpp
@@ -36,30 +36,6 @@
 
 #include "enumeration.h"
 
-JSObject*
-gjs_lookup_enumeration(JSContext    *context,
-                       GIEnumInfo   *info)
-{
-    JSObject *in_object;
-    const char *enum_name;
-    JS::Value value;
-
-    in_object = gjs_lookup_namespace_object(context, (GIBaseInfo*) info);
-
-    if (G_UNLIKELY (!in_object))
-        return NULL;
-
-    enum_name = g_base_info_get_name((GIBaseInfo*) info);
-
-    if (!JS_GetProperty(context, in_object, enum_name, &value))
-        return NULL;
-
-    if (G_UNLIKELY (!value.isObject()))
-        return NULL;
-
-    return &value.toObject();
-}
-
 static bool
 gjs_define_enum_value(JSContext    *context,
                       JSObject     *in_object,
diff --git a/gi/enumeration.h b/gi/enumeration.h
index 70fe072..27b0e1d 100644
--- a/gi/enumeration.h
+++ b/gi/enumeration.h
@@ -42,8 +42,6 @@ bool    gjs_define_enum_static_methods (JSContext    *context,
 bool    gjs_define_enumeration         (JSContext    *context,
                                         JSObject     *in_object,
                                         GIEnumInfo   *info);
-JSObject* gjs_lookup_enumeration       (JSContext    *context,
-                                        GIEnumInfo   *info);
 
 G_END_DECLS
 
diff --git a/gi/function.h b/gi/function.h
index f86b815..507e553 100644
--- a/gi/function.h
+++ b/gi/function.h
@@ -81,8 +81,6 @@ bool      gjs_invoke_constructor_from_c(JSContext       *context,
                                         JS::Value       *argv,
                                         GArgument       *rvalue);
 
-void     gjs_init_cinvoke_profiling (void);
-
 G_END_DECLS
 
 #endif  /* __GJS_FUNCTION_H__ */
diff --git a/gi/fundamental.cpp b/gi/fundamental.cpp
index 484d963..72d82c7 100644
--- a/gi/fundamental.cpp
+++ b/gi/fundamental.cpp
@@ -833,14 +833,6 @@ gjs_g_fundamental_from_object(JSContext       *context,
 }
 
 bool
-gjs_typecheck_is_fundamental(JSContext       *context,
-                             JS::HandleObject object,
-                             bool             throw_error)
-{
-    return do_base_typecheck(context, object, throw_error);
-}
-
-bool
 gjs_typecheck_fundamental(JSContext       *context,
                           JS::HandleObject object,
                           GType            expected_gtype,
diff --git a/gi/fundamental.h b/gi/fundamental.h
index dec8fcf..d67750c 100644
--- a/gi/fundamental.h
+++ b/gi/fundamental.h
@@ -53,9 +53,6 @@ bool      gjs_typecheck_fundamental(JSContext       *context,
                                     GType            expected_gtype,
                                     bool             throw_error);
 
-bool      gjs_typecheck_is_fundamental       (JSContext     *context,
-                                              JSObject      *object,
-                                              bool           throw_error);
 void*     gjs_fundamental_ref                (JSContext     *context,
                                               void          *fobj);
 void      gjs_fundamental_unref              (JSContext     *context,
diff --git a/gi/gtype.h b/gi/gtype.h
index f9fa179..0cdbff7 100644
--- a/gi/gtype.h
+++ b/gi/gtype.h
@@ -32,11 +32,6 @@
 
 G_BEGIN_DECLS
 
-JS::Value   gjs_gtype_create_proto         (JSContext       *context,
-                                            JSObject        *module,
-                                            const char      *proto_name,
-                                            JSObject        *parent);
-
 JSObject * gjs_gtype_create_gtype_wrapper (JSContext *context,
                                            GType      gtype);
 
diff --git a/gi/keep-alive.cpp b/gi/keep-alive.cpp
index c533a53..396741e 100644
--- a/gi/keep-alive.cpp
+++ b/gi/keep-alive.cpp
@@ -172,7 +172,7 @@ JSFunctionSpec gjs_keep_alive_proto_funcs[] = {
     JS_FS_END
 };
 
-JSObject*
+static JSObject *
 gjs_keep_alive_new(JSContext *context)
 {
     KeepAlive *priv;
diff --git a/gi/keep-alive.h b/gi/keep-alive.h
index 5a1b68f..624bf12 100644
--- a/gi/keep-alive.h
+++ b/gi/keep-alive.h
@@ -54,7 +54,6 @@ typedef void (* GjsUnrootedFunc) (JSObject *obj,
                                   void     *data);
 
 
-JSObject* gjs_keep_alive_new                       (JSContext         *context);
 void      gjs_keep_alive_add_child                 (JSObject          *keep_alive,
                                                     GjsUnrootedFunc    notify,
                                                     JSObject          *child,
diff --git a/gi/repo.h b/gi/repo.h
index 064c71c..867b8c1 100644
--- a/gi/repo.h
+++ b/gi/repo.h
@@ -43,8 +43,7 @@ JSObject*   gjs_lookup_namespace_object         (JSContext      *context,
                                                  GIBaseInfo     *info);
 JSObject*   gjs_lookup_namespace_object_by_name (JSContext      *context,
                                                  jsid            name);
-JSObject*   gjs_lookup_function_object          (JSContext      *context,
-                                                 GIFunctionInfo *info);
+
 JSObject *  gjs_lookup_generic_constructor      (JSContext      *context,
                                                  GIBaseInfo     *info);
 JSObject *  gjs_lookup_generic_prototype        (JSContext      *context,
diff --git a/gjs/byteArray.cpp b/gjs/byteArray.cpp
index a5e6ede..b257daa 100644
--- a/gjs/byteArray.cpp
+++ b/gjs/byteArray.cpp
@@ -779,31 +779,6 @@ gjs_byte_array_from_byte_array (JSContext *context,
     return object;
 }
 
-JSObject *
-gjs_byte_array_from_bytes (JSContext *context,
-                           GBytes    *bytes)
-{
-    ByteArrayInstance *priv;
-
-    g_return_val_if_fail(context != NULL, NULL);
-    g_return_val_if_fail(bytes != NULL, NULL);
-
-    JS::RootedObject object(context,
-                            JS_NewObject(context, &gjs_byte_array_class,
-                                         byte_array_get_prototype(context), NULL));
-    if (!object) {
-        gjs_throw(context, "failed to create byte array");
-        return NULL;
-    }
-
-    priv = g_slice_new0(ByteArrayInstance);
-    g_assert(priv_from_js(context, object) == NULL);
-    JS_SetPrivate(object, priv);
-    priv->bytes = g_bytes_ref (bytes);
-
-    return object;
-}
-
 GBytes *
 gjs_byte_array_get_bytes (JSContext       *context,
                           JS::HandleObject object)
diff --git a/gjs/byteArray.h b/gjs/byteArray.h
index 72cb393..0c591a8 100644
--- a/gjs/byteArray.h
+++ b/gjs/byteArray.h
@@ -39,8 +39,6 @@ bool          gjs_define_byte_array_stuff    (JSContext  *context,
 
 JSObject *    gjs_byte_array_from_byte_array (JSContext  *context,
                                               GByteArray *array);
-JSObject *    gjs_byte_array_from_bytes (JSContext  *context,
-                                         GBytes *bytes);
 
 GByteArray *gjs_byte_array_get_byte_array(JSContext       *context,
                                           JS::HandleObject object);
diff --git a/gjs/coverage-internal.h b/gjs/coverage-internal.h
index 3f5f4c9..8ad59e5 100644
--- a/gjs/coverage-internal.h
+++ b/gjs/coverage-internal.h
@@ -26,8 +26,6 @@
 
 G_BEGIN_DECLS
 
-GArray * gjs_fetch_statistics_from_js(GjsCoverage *coverage,
-                                      char        **covered_paths);
 GBytes * gjs_serialize_statistics(GjsCoverage *coverage);
 
 JSString * gjs_deserialize_cache_to_object(GjsCoverage *coverage,
diff --git a/gjs/coverage.cpp b/gjs/coverage.cpp
index a415a13..544ce77 100644
--- a/gjs/coverage.cpp
+++ b/gjs/coverage.cpp
@@ -1106,7 +1106,7 @@ gjs_deserialize_cache_to_object(GjsCoverage *coverage,
     return gjs_deserialize_cache_to_object_for_compartment(context, global_object, cache_data);
 }
 
-GArray *
+static GArray *
 gjs_fetch_statistics_from_js(GjsCoverage *coverage,
                              gchar       **coverage_files)
 {
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index 6b6e95d..2dc8c9f 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -369,105 +369,6 @@ gjs_value_debug_string(JSContext      *context,
     return debugstr;
 }
 
-void
-gjs_log_object_props(JSContext      *context,
-                     JSObject       *obj,
-                     GjsDebugTopic   topic,
-                     const char     *prefix)
-{
-    JSObject *props_iter;
-    jsid prop_id;
-
-    JS_BeginRequest(context);
-
-    props_iter = JS_NewPropertyIterator(context, obj);
-    if (props_iter == NULL) {
-        gjs_log_exception(context);
-        goto done;
-    }
-
-    prop_id = JSID_VOID;
-    if (!JS_NextProperty(context, props_iter, &prop_id))
-        goto done;
-
-    while (!JSID_IS_VOID(prop_id)) {
-        JS::Value propval;
-        char *debugstr;
-        char *name = NULL;
-
-        if (!JS_GetPropertyById(context, obj, prop_id, &propval))
-            goto next;
-
-        if (!gjs_get_string_id(context, prop_id, &name))
-            goto next;
-
-        debugstr = gjs_value_debug_string(context, propval);
-        gjs_debug(topic,
-                  "%s%s = '%s'",
-                  prefix, name,
-                  debugstr);
-        g_free(debugstr);
-
-    next:
-        g_free(name);
-        prop_id = JSID_VOID;
-        if (!JS_NextProperty(context, props_iter, &prop_id))
-            break;
-    }
-
- done:
-    JS_EndRequest(context);
-}
-
-void
-gjs_explain_scope(JSContext  *context,
-                  const char *title)
-{
-    JSObject *global;
-    JSObject *parent;
-    GString *chain;
-    char *debugstr;
-
-    gjs_debug(GJS_DEBUG_SCOPE,
-              "=== %s ===",
-              title);
-
-    JS_BeginRequest(context);
-
-    gjs_debug(GJS_DEBUG_SCOPE,
-              "  Context: %p %s",
-              context,
-              "");
-
-    global = gjs_get_global_object(context);
-    debugstr = gjs_value_debug_string(context, JS::ObjectOrNullValue(global));
-    gjs_debug(GJS_DEBUG_SCOPE,
-              "  Global: %p %s",
-              global, debugstr);
-    g_free(debugstr);
-
-    parent = JS_GetGlobalForScopeChain(context);
-    chain = g_string_new(NULL);
-    while (parent != NULL) {
-        char *debug;
-        debug = gjs_value_debug_string(context, JS::ObjectOrNullValue(parent));
-
-        if (chain->len > 0)
-            g_string_append(chain, ", ");
-
-        g_string_append_printf(chain, "%p %s",
-                               parent, debug);
-        g_free(debug);
-        parent = JS_GetParent(parent);
-    }
-    gjs_debug(GJS_DEBUG_SCOPE,
-              "  Chain: %s",
-              chain->str);
-    g_string_free(chain, true);
-
-    JS_EndRequest(context);
-}
-
 static char *
 utf8_exception_from_non_gerror_value(JSContext *cx,
                                      JS::Value  exc)
@@ -586,9 +487,8 @@ gjs_log_exception_full(JSContext *context,
     return true;
 }
 
-static bool
-log_and_maybe_keep_exception(JSContext  *context,
-                             bool        keep)
+bool
+gjs_log_exception(JSContext  *context)
 {
     bool retval = false;
 
@@ -602,12 +502,6 @@ log_and_maybe_keep_exception(JSContext  *context,
 
     gjs_log_exception_full(context, exc, NULL);
 
-    /* We clear above and then set it back so any exceptions
-     * from the logging process don't overwrite the original
-     */
-    if (keep)
-        JS_SetPendingException(context, exc);
-
     retval = true;
 
  out:
@@ -616,18 +510,6 @@ log_and_maybe_keep_exception(JSContext  *context,
     return retval;
 }
 
-bool
-gjs_log_exception(JSContext  *context)
-{
-    return log_and_maybe_keep_exception(context, false);
-}
-
-bool
-gjs_log_and_keep_exception(JSContext *context)
-{
-    return log_and_maybe_keep_exception(context, true);
-}
-
 static void
 try_to_chain_stack_trace(JSContext *src_context,
                          JSContext *dst_context,
@@ -755,42 +637,6 @@ log_prop(JSContext  *context,
     return true;
 }
 
-bool
-gjs_get_prop_verbose_stub(JSContext *context,
-                          JSObject  *obj,
-                          JS::Value  id,
-                          JS::Value *value_p)
-{
-    return log_prop(context, obj, id, value_p, "get");
-}
-
-bool
-gjs_set_prop_verbose_stub(JSContext *context,
-                          JSObject  *obj,
-                          JS::Value  id,
-                          JS::Value *value_p)
-{
-    return log_prop(context, obj, id, value_p, "set");
-}
-
-bool
-gjs_add_prop_verbose_stub(JSContext *context,
-                          JSObject  *obj,
-                          JS::Value  id,
-                          JS::Value *value_p)
-{
-    return log_prop(context, obj, id, value_p, "add");
-}
-
-bool
-gjs_delete_prop_verbose_stub(JSContext *context,
-                             JSObject  *obj,
-                             JS::Value  id,
-                             JS::Value *value_p)
-{
-    return log_prop(context, obj, id, value_p, "delete");
-}
-
 /* get a debug string for type tag in JS::Value */
 const char*
 gjs_get_type_name(JS::Value value)
@@ -1017,12 +863,11 @@ gjs_parse_args_valist (JSContext  *context,
 }
 
 /**
- * gjs_parse_args:
+ * gjs_parse_call_args:
  * @context:
  * @function_name: The name of the function being called
  * @format: Printf-like format specifier containing the expected arguments
- * @argc: Number of JavaScript arguments
- * @argv: JavaScript argument array
+ * @call_args: JS::CallArgs from function invocation
  * @Varargs: for each character in @format, a pair of a char * which is the name
  * of the argument, and a pointer to a location to store the value. The type of
  * value stored depends on the format character, as described below.
@@ -1051,22 +896,6 @@ gjs_parse_args_valist (JSContext  *context,
  * which case the C value %NULL is returned.
  */
 bool
-gjs_parse_args (JSContext  *context,
-                const char *function_name,
-                const char *format,
-                unsigned    argc,
-                JS::Value  *argv,
-                ...)
-{
-    va_list args;
-    bool ret;
-    va_start (args, argv);
-    ret = gjs_parse_args_valist (context, function_name, format, argc, argv, args);
-    va_end (args);
-    return ret;
-}
-
-bool
 gjs_parse_call_args (JSContext    *context,
                      const char   *function_name,
                      const char   *format,
diff --git a/gjs/jsapi-util.h b/gjs/jsapi-util.h
index bf38c02..562e0c0 100644
--- a/gjs/jsapi-util.h
+++ b/gjs/jsapi-util.h
@@ -320,23 +320,15 @@ void        gjs_throw_g_error                (JSContext       *context,
                                               GError          *error);
 
 bool        gjs_log_exception                (JSContext       *context);
-bool        gjs_log_and_keep_exception       (JSContext       *context);
 bool        gjs_move_exception               (JSContext       *src_context,
                                               JSContext       *dest_context);
 bool        gjs_log_exception_full           (JSContext       *context,
                                               JS::Value        exc,
                                               JSString        *message);
 
-#ifdef __GJS_UTIL_LOG_H__
-void        gjs_log_object_props             (JSContext       *context,
-                                              JSObject        *obj,
-                                              GjsDebugTopic    topic,
-                                              const char      *prefix);
-#endif
 char*       gjs_value_debug_string           (JSContext       *context,
                                               JS::Value        value);
-void        gjs_explain_scope                (JSContext       *context,
-                                              const char      *title);
+
 bool        gjs_call_function_value          (JSContext       *context,
                                               JSObject        *obj,
                                               JS::Value        fval,
@@ -347,22 +339,6 @@ void        gjs_error_reporter               (JSContext       *context,
                                               const char      *message,
                                               JSErrorReport   *report);
 JSObject*   gjs_get_global_object            (JSContext *cx);
-bool        gjs_get_prop_verbose_stub        (JSContext       *context,
-                                              JSObject        *obj,
-                                              JS::Value        id,
-                                              JS::Value       *value_p);
-bool        gjs_set_prop_verbose_stub        (JSContext       *context,
-                                              JSObject        *obj,
-                                              JS::Value        id,
-                                              JS::Value       *value_p);
-bool        gjs_add_prop_verbose_stub        (JSContext       *context,
-                                              JSObject        *obj,
-                                              JS::Value        id,
-                                              JS::Value       *value_p);
-bool        gjs_delete_prop_verbose_stub     (JSContext       *context,
-                                              JSObject        *obj,
-                                              JS::Value        id,
-                                              JS::Value       *value_p);
 
 JSBool      gjs_string_to_utf8               (JSContext       *context,
                                               const JS::Value  string_val,
@@ -394,13 +370,6 @@ bool        gjs_unichar_from_string          (JSContext       *context,
 
 const char* gjs_get_type_name                (JS::Value        value);
 
-bool        gjs_parse_args                   (JSContext  *context,
-                                              const char *function_name,
-                                              const char *format,
-                                              unsigned   argc,
-                                              JS::Value  *argv,
-                                              ...);
-
 bool        gjs_parse_call_args              (JSContext    *context,
                                               const char   *function_name,
                                               const char   *format,
diff --git a/modules/console.cpp b/modules/console.cpp
index e54a511..b3083e3 100644
--- a/modules/console.cpp
+++ b/modules/console.cpp
@@ -153,7 +153,7 @@ gjs_console_readline(JSContext *cx, char **bufp, FILE *file, const char *prompt)
 }
 #endif
 
-bool
+static bool
 gjs_console_interact(JSContext *context,
                      unsigned   argc,
                      JS::Value *vp)
diff --git a/modules/console.h b/modules/console.h
index 2d41d65..5607584 100644
--- a/modules/console.h
+++ b/modules/console.h
@@ -32,9 +32,6 @@ G_BEGIN_DECLS
 
 bool        gjs_define_console_stuff     (JSContext      *context,
                                           JSObject      **module_out);
-bool        gjs_console_interact         (JSContext      *context,
-                                          unsigned        argc,
-                                          JS::Value      *vp);
 
 G_END_DECLS
 


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