aboutsummaryrefslogtreecommitdiffstats
path: root/symbol.c
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2019-11-13 12:41:39 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2019-11-14 20:35:48 +0900
commitc9ffe751d126a302d0e7e53e645e44084e339dde (patch)
tree0393401c6f11ee528ef30fdd1d51fc96b7837a9c /symbol.c
parent4d615a0c8f4759ce4f6b96b643ef957837bdf20e (diff)
downloadruby-c9ffe751d126a302d0e7e53e645e44084e339dde.tar.gz
delete unused functions
Looking at the list of symbols inside of libruby-static.a, I found hundreds of functions that are defined, but used from nowhere. There can be reasons for each of them (e.g. some functions are specific to some platform, some are useful when debugging, etc). However it seems the functions deleted here exist for no reason. This changeset reduces the size of ruby binary from 26,671,456 bytes to 26,592,864 bytes on my machine.
Diffstat (limited to 'symbol.c')
-rw-r--r--symbol.c102
1 files changed, 0 insertions, 102 deletions
diff --git a/symbol.c b/symbol.c
index 046c8e1105..14517df01e 100644
--- a/symbol.c
+++ b/symbol.c
@@ -92,8 +92,6 @@ WARN_UNUSED_RESULT(static VALUE dsymbol_check(const VALUE sym));
WARN_UNUSED_RESULT(static ID lookup_str_id(VALUE str));
WARN_UNUSED_RESULT(static VALUE lookup_str_sym(const VALUE str));
WARN_UNUSED_RESULT(static VALUE lookup_id_str(ID id));
-WARN_UNUSED_RESULT(static ID attrsetname_to_attr(VALUE name));
-WARN_UNUSED_RESULT(static ID attrsetname_to_attr_id(VALUE name));
WARN_UNUSED_RESULT(static ID intern_str(VALUE str, int mutable));
ID
@@ -154,12 +152,6 @@ rb_id_attrset(ID id)
return id;
}
-ID
-rb_id_attrget(ID id)
-{
- return attrsetname_to_attr(rb_id2str(id));
-}
-
static int
is_special_global_name(const char *m, const char *e, rb_encoding *enc)
{
@@ -907,41 +899,11 @@ rb_is_const_sym(VALUE sym)
}
int
-rb_is_class_sym(VALUE sym)
-{
- return is_class_sym(sym);
-}
-
-int
-rb_is_global_sym(VALUE sym)
-{
- return is_global_sym(sym);
-}
-
-int
-rb_is_instance_sym(VALUE sym)
-{
- return is_instance_sym(sym);
-}
-
-int
rb_is_attrset_sym(VALUE sym)
{
return is_attrset_sym(sym);
}
-int
-rb_is_local_sym(VALUE sym)
-{
- return is_local_sym(sym);
-}
-
-int
-rb_is_junk_sym(VALUE sym)
-{
- return is_junk_sym(sym);
-}
-
/**
* Returns ID for the given name if it is interned already, or 0.
*
@@ -1049,13 +1011,11 @@ rb_check_symbol_cstr(const char *ptr, long len, rb_encoding *enc)
return Qnil;
}
-#undef rb_sym_intern_cstr
#undef rb_sym_intern_ascii_cstr
#ifdef __clang__
NOINLINE(VALUE rb_sym_intern(const char *ptr, long len, rb_encoding *enc));
#else
FUNC_MINIMIZED(VALUE rb_sym_intern(const char *ptr, long len, rb_encoding *enc));
-FUNC_MINIMIZED(VALUE rb_sym_intern_cstr(const char *ptr, rb_encoding *enc));
FUNC_MINIMIZED(VALUE rb_sym_intern_ascii(const char *ptr, long len));
FUNC_MINIMIZED(VALUE rb_sym_intern_ascii_cstr(const char *ptr));
#endif
@@ -1069,12 +1029,6 @@ rb_sym_intern(const char *ptr, long len, rb_encoding *enc)
}
VALUE
-rb_sym_intern_cstr(const char *ptr, rb_encoding *enc)
-{
- return rb_sym_intern(ptr, strlen(ptr), enc);
-}
-
-VALUE
rb_sym_intern_ascii(const char *ptr, long len)
{
return rb_sym_intern(ptr, len, rb_usascii_encoding());
@@ -1092,34 +1046,6 @@ rb_to_symbol_type(VALUE obj)
return rb_convert_type_with_id(obj, T_SYMBOL, "Symbol", idTo_sym);
}
-static ID
-attrsetname_to_attr_id(VALUE name)
-{
- ID id;
- struct RString fake_str;
- /* make local name by chopping '=' */
- const VALUE localname = rb_setup_fake_str(&fake_str,
- RSTRING_PTR(name), RSTRING_LEN(name) - 1,
- rb_enc_get(name));
- OBJ_FREEZE(localname);
-
- if ((id = lookup_str_id(localname)) != 0) {
- return id;
- }
- RB_GC_GUARD(name);
- return (ID)0;
-}
-
-static ID
-attrsetname_to_attr(VALUE name)
-{
- if (rb_is_attrset_name(name)) {
- return attrsetname_to_attr_id(name);
- }
-
- return (ID)0;
-}
-
int
rb_is_const_name(VALUE name)
{
@@ -1133,43 +1059,15 @@ rb_is_class_name(VALUE name)
}
int
-rb_is_global_name(VALUE name)
-{
- return rb_str_symname_type(name, 0) == ID_GLOBAL;
-}
-
-int
rb_is_instance_name(VALUE name)
{
return rb_str_symname_type(name, 0) == ID_INSTANCE;
}
int
-rb_is_attrset_name(VALUE name)
-{
- return rb_str_symname_type(name, IDSET_ATTRSET_FOR_INTERN) == ID_ATTRSET;
-}
-
-int
rb_is_local_name(VALUE name)
{
return rb_str_symname_type(name, 0) == ID_LOCAL;
}
-int
-rb_is_method_name(VALUE name)
-{
- switch (rb_str_symname_type(name, 0)) {
- case ID_LOCAL: case ID_ATTRSET: case ID_JUNK:
- return TRUE;
- }
- return FALSE;
-}
-
-int
-rb_is_junk_name(VALUE name)
-{
- return rb_str_symname_type(name, IDSET_ATTRSET_FOR_SYNTAX) == -1;
-}
-
#include "id_table.c"