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



commit 8889e6de4bcfbc4b2cccd32e62ef432572fdc531
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 haven't looked at the util/ directory yet.

 gi/arg.cpp              |    4 +-
 gi/arg.h                |    7 --
 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       |   45 ------------
 gjs/byteArray.h         |    7 --
 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, 12 insertions(+), 325 deletions(-)
---
diff --git a/gi/arg.cpp b/gi/arg.cpp
index 47773a3..336c877 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)
@@ -135,7 +135,7 @@ _gjs_enum_uses_signed_type (GIEnumInfo *enum_info)
  * is found in g_value_set_enum/g_value_set_flags().
  */
 
-gint64
+static gint64
 _gjs_enum_from_int (GIEnumInfo *enum_info,
                     int         int_value)
 {
diff --git a/gi/arg.h b/gi/arg.h
index ca6fdcf..162769c 100644
--- a/gi/arg.h
+++ b/gi/arg.h
@@ -101,13 +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);
-
 bool gjs_array_from_strv (JSContext   *context,
                           JS::Value   *value_p,
                           const char **strv);
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 4be881a..7e99511 100644
--- a/gi/fundamental.cpp
+++ b/gi/fundamental.cpp
@@ -837,14 +837,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 462ce27..6f8090d 100644
--- a/gi/keep-alive.cpp
+++ b/gi/keep-alive.cpp
@@ -172,7 +172,7 @@ JSFunctionSpec gjs_keep_alive_proto_funcs[] = {
     { NULL }
 };
 
-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 6313b99..74909be 100644
--- a/gjs/byteArray.cpp
+++ b/gjs/byteArray.cpp
@@ -781,31 +781,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)
@@ -832,26 +807,6 @@ gjs_byte_array_get_byte_array (JSContext       *context,
     return g_byte_array_ref (priv->array);
 }
 
-void
-gjs_byte_array_peek_data (JSContext       *context,
-                          JS::HandleObject obj,
-                          guint8         **out_data,
-                          gsize           *out_len)
-{
-    ByteArrayInstance *priv;
-    priv = priv_from_js(context, obj);
-    g_assert(priv != NULL);
-    
-    if (priv->array != NULL) {
-        *out_data = (guint8*)priv->array->data;
-        *out_len = (gsize)priv->array->len;
-    } else if (priv->bytes != NULL) {
-        *out_data = (guint8*)g_bytes_get_data(priv->bytes, out_len);
-    } else {
-        g_assert_not_reached();
-    }
-}
-
 JSPropertySpec gjs_byte_array_proto_props[] = {
     { "length", 0,
       JSPROP_PERMANENT,
diff --git a/gjs/byteArray.h b/gjs/byteArray.h
index 72cb393..dfb9236 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);
@@ -48,11 +46,6 @@ GByteArray *gjs_byte_array_get_byte_array(JSContext       *context,
 GBytes     *gjs_byte_array_get_bytes(JSContext       *context,
                                      JS::HandleObject object);
 
-void        gjs_byte_array_peek_data(JSContext       *context,
-                                     JS::HandleObject object,
-                                     guint8         **out_data,
-                                     gsize           *out_len);
-
 G_END_DECLS
 
 #endif  /* __GJS_BYTE_ARRAY_H__ */
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 3a2b491..cd2a146 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 11d918d..057f498 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -370,105 +370,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)
@@ -587,9 +488,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;
 
@@ -603,12 +503,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:
@@ -617,18 +511,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,
@@ -756,42 +638,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)
@@ -1018,12 +864,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.
@@ -1052,22 +897,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 939ed6c..82b18fb 100644
--- a/gjs/jsapi-util.h
+++ b/gjs/jsapi-util.h
@@ -322,23 +322,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,
@@ -349,22 +341,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,
@@ -396,13 +372,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]