From: Charlie Brej Date: Sun, 12 Jul 2009 18:04:53 +0000 (+0100) Subject: [script] Remove print object function which was unused X-Git-Tag: 0.7.0~87 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f787ec7744327ed4f8f5d1e5080b0677a42db332;p=thirdparty%2Fplymouth.git [script] Remove print object function which was unused It was useful when the language was being constructed to make sure reference counts were sane but only worked in text mode. --- diff --git a/src/plugins/splash/script/script-object.c b/src/plugins/splash/script/script-object.c index 7c12c1eb..22d84e2b 100644 --- a/src/plugins/splash/script/script-object.c +++ b/src/plugins/splash/script/script-object.c @@ -36,7 +36,6 @@ #include "script.h" #include "script-object.h" -char *script_obj_print (script_obj_t *obj); void script_obj_reset (script_obj_t *obj); void script_obj_free (script_obj_t *obj) @@ -143,87 +142,6 @@ void script_obj_deref (script_obj_t **obj_ptr) *obj_ptr = obj; } -static void foreach_print_vareable (void *key, - void *data, - void *user_data) -{ - script_vareable_t *vareable = data; - char *string = script_obj_print (vareable->object); - char *reply; - char *prev = *(char **) user_data; - - if (!prev) prev = strdup (""); - asprintf (&reply, "%s%s = %s\n", prev, vareable->name, string); - free (string); - free (prev); - *(char **) user_data = reply; -} - -char *script_obj_print (script_obj_t *obj) -{ - char *reply; - - switch (obj->type) - { - case SCRIPT_OBJ_TYPE_REF: - { - char *subobj = script_obj_print (obj->data.obj); - asprintf (&reply, "->[%d]%s", obj->refcount, subobj); - free (subobj); - return reply; - } - - case SCRIPT_OBJ_TYPE_INT: - { - asprintf (&reply, "%d[%d]", obj->data.integer, obj->refcount); - return reply; - } - - case SCRIPT_OBJ_TYPE_FLOAT: - { - asprintf (&reply, "%f[%d]", obj->data.floatpoint, obj->refcount); - return reply; - } - - case SCRIPT_OBJ_TYPE_STRING: - { - asprintf (&reply, "\"%s\"[%d]", obj->data.string, obj->refcount); - return reply; - } - - case SCRIPT_OBJ_TYPE_NULL: - { - asprintf (&reply, "NULL[%d]", obj->refcount); - return reply; - } - - case SCRIPT_OBJ_TYPE_HASH: - { - char *sub = NULL; - ply_hashtable_foreach (obj->data.hash, foreach_print_vareable, &sub); - asprintf (&reply, "HASH{\n%s}[%d]", sub, obj->refcount); - free (sub); - return reply; - } - - case SCRIPT_OBJ_TYPE_FUNCTION: - { - asprintf (&reply, "function()[%d]", obj->refcount); - return reply; - } - - case SCRIPT_OBJ_TYPE_NATIVE: - { - asprintf (&reply, - "(%s)[%d]", - obj->data.native.class->name, - obj->refcount); - return reply; - } - } - return NULL; -} - script_obj_t *script_obj_new_null (void) { script_obj_t *obj = malloc (sizeof (script_obj_t)); diff --git a/src/plugins/splash/script/script-object.h b/src/plugins/splash/script/script-object.h index 355d9f7f..4740cccf 100644 --- a/src/plugins/splash/script/script-object.h +++ b/src/plugins/splash/script/script-object.h @@ -39,7 +39,6 @@ void script_obj_unref (script_obj_t *obj); void script_obj_reset (script_obj_t *obj); script_obj_t *script_obj_deref_direct (script_obj_t *obj); void script_obj_deref (script_obj_t **obj_ptr); -char *script_obj_print (script_obj_t *obj); script_obj_t *script_obj_new_int (int number); script_obj_t *script_obj_new_float (float number); script_obj_t *script_obj_new_string (const char *string);