summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoerg Sonnenberger <joerg@bec.de>2011-05-20 17:30:12 +0200
committerJoerg Sonnenberger <joerg@bec.de>2011-05-20 17:30:12 +0200
commit798f9da2ca3ff11f91a7084a1f15cad033d4d16d (patch)
tree539eb05ac31782238121da2ebbe064cd7036073b /src
parentd73693970c7c5222d7a7b83695c0f72c139cf720 (diff)
downloadlibcxxrt-798f9da2ca3ff11f91a7084a1f15cad033d4d16d.tar.gz
libcxxrt-798f9da2ca3ff11f91a7084a1f15cad033d4d16d.tar.bz2
libcxxrt-798f9da2ca3ff11f91a7084a1f15cad033d4d16d.tar.xz
Merge libelftc_vstr.c into libelftc_dem_gnu3.c to reduce namespace
pollution. Retire unused libelftc headers.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/_libelftc.h74
-rw-r--r--src/libelftc.h64
-rw-r--r--src/libelftc_dem_gnu3.c311
-rw-r--r--src/libelftc_vstr.c315
-rw-r--r--src/typeinfo.cc1
6 files changed, 291 insertions, 475 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7b79434..be676cd 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -8,7 +8,6 @@ set(CXXRT_SOURCES
memory.cc
aux.cc
libelftc_dem_gnu3.c
- libelftc_vstr.c
)
diff --git a/src/_libelftc.h b/src/_libelftc.h
deleted file mode 100644
index 283e50f..0000000
--- a/src/_libelftc.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*-
- * Copyright (c) 2009 Kai Wang
- * Copyright (c) 2007,2008 Hyogeol Lee <hyogeollee@gmail.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer
- * in this position and unchanged.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __LIBELFTC_H_
-#define __LIBELFTC_H_
-
-#include <stdbool.h>
-
-/** @brief Dynamic vector data for string. */
-struct vector_str {
- /** Current size */
- size_t size;
- /** Total capacity */
- size_t capacity;
- /** String array */
- char **container;
-};
-
-#define BUFFER_GROWFACTOR 1.618
-#define VECTOR_DEF_CAPACITY 8
-#define ELFTC_ISDIGIT(C) (isdigit((C) & 0xFF))
-
-void vector_str_dest(struct vector_str *);
-int vector_str_find(const struct vector_str *v, const char *o, size_t l);
-char *vector_str_get_flat(const struct vector_str *v, size_t *l);
-bool vector_str_init(struct vector_str *);
-bool vector_str_pop(struct vector_str *);
-bool vector_str_push(struct vector_str *, const char *, size_t);
-bool vector_str_push_vector_head(struct vector_str *dst,
- struct vector_str *org);
-char *vector_str_substr(const struct vector_str *v, size_t begin, size_t end,
- size_t *r_len);
-char *cpp_demangle_gnu3(const char *);
-bool is_cpp_mangled_gnu3(const char *);
-char *cpp_demangle_gnu2(const char *);
-bool is_cpp_mangled_gnu2(const char *);
-char *cpp_demangle_ARM(const char *);
-bool is_cpp_mangled_ARM(const char *);
-
-/*
- * Symbols that are sometimes missing from system headers.
- *
- * TODO: Move these to a project-wide file.
- */
-
-#ifndef EM_AVR
-#define EM_AVR 83
-#endif
-
-#endif /* __LIBELFTC_H */
diff --git a/src/libelftc.h b/src/libelftc.h
deleted file mode 100644
index 4781e9c..0000000
--- a/src/libelftc.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*-
- * Copyright (c) 2009 Kai Wang
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer
- * in this position and unchanged.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD: users/kaiwang27/elftc/libelftc.h 392 2009-05-31 19:17:46Z kaiwang27 $
- */
-
-#ifndef _LIBELFTC_H_
-#define _LIBELFTC_H_
-
-typedef struct _Bfd_Target Bfd_Target;
-
-/* Target types. */
-typedef enum {
- ETF_NONE,
- ETF_ELF,
- ETF_BINARY,
- ETF_SREC,
- ETF_IHEX
-} Bfd_Target_Flavor;
-
-/*
- * Demangler flags.
- */
-
-/* Name mangling style. */
-#define ELFTC_DEM_ARM 0x00000001U
-#define ELFTC_DEM_GNU2 0x00000002U
-#define ELFTC_DEM_GNU3 0x00000004U
-
-/* Demangling behaviour control. */
-#define ELFTC_DEM_NOPARAM 0x00010000U
-
-__BEGIN_DECLS
-Bfd_Target *elftc_bfd_find_target(const char *tgt_name);
-Bfd_Target_Flavor elftc_bfd_target_flavor(Bfd_Target *tgt);
-unsigned int elftc_bfd_target_byteorder(Bfd_Target *tgt);
-unsigned int elftc_bfd_target_class(Bfd_Target *tgt);
-int elftc_demangle(const char *mangledname, char *buffer,
- size_t bufsize, unsigned int flags);
-__END_DECLS
-
-#endif /* _LIBELFTC_H_ */
diff --git a/src/libelftc_dem_gnu3.c b/src/libelftc_dem_gnu3.c
index 8dff888..ddf7853 100644
--- a/src/libelftc_dem_gnu3.c
+++ b/src/libelftc_dem_gnu3.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2007 Hyogeol Lee <hyogeollee@gmail.com>
+ * Copyright (c) 2007, 2008 Hyogeol Lee <hyogeollee@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,8 +33,6 @@
#include <stdlib.h>
#include <string.h>
-#include "_libelftc.h"
-
/**
* @file cpp_demangle.c
* @brief Decode IA-64 C++ ABI style implementation.
@@ -45,6 +43,20 @@
* http://www.codesourcery.com/cxx-abi/abi-mangling.html
*/
+/** @brief Dynamic vector data for string. */
+struct vector_str {
+ /** Current size */
+ size_t size;
+ /** Total capacity */
+ size_t capacity;
+ /** String array */
+ char **container;
+};
+
+#define BUFFER_GROWFACTOR 1.618
+#define VECTOR_DEF_CAPACITY 8
+#define ELFTC_ISDIGIT(C) (isdigit((C) & 0xFF))
+
enum type_qualifier {
TYPE_PTR, TYPE_REF, TYPE_CMX, TYPE_IMG, TYPE_EXT, TYPE_RST, TYPE_VAT,
TYPE_CST
@@ -90,6 +102,281 @@ struct cpp_demangle_data {
#define SIMPLE_HASH(x,y) (64 * x + y)
+static size_t get_strlen_sum(const struct vector_str *v);
+static bool vector_str_grow(struct vector_str *v);
+
+static size_t
+get_strlen_sum(const struct vector_str *v)
+{
+ size_t i, len = 0;
+
+ if (v == NULL)
+ return (0);
+
+ assert(v->size > 0);
+
+ for (i = 0; i < v->size; ++i)
+ len += strlen(v->container[i]);
+
+ return (len);
+}
+
+/**
+ * @brief Deallocate resource in vector_str.
+ */
+static void
+vector_str_dest(struct vector_str *v)
+{
+ size_t i;
+
+ if (v == NULL)
+ return;
+
+ for (i = 0; i < v->size; ++i)
+ free(v->container[i]);
+
+ free(v->container);
+}
+
+/**
+ * @brief Find string in vector_str.
+ * @param v Destination vector.
+ * @param o String to find.
+ * @param l Length of the string.
+ * @return -1 at failed, 0 at not found, 1 at found.
+ */
+static int
+vector_str_find(const struct vector_str *v, const char *o, size_t l)
+{
+ size_t i;
+
+ if (v == NULL || o == NULL)
+ return (-1);
+
+ for (i = 0; i < v->size; ++i)
+ if (strncmp(v->container[i], o, l) == 0)
+ return (1);
+
+ return (0);
+}
+
+/**
+ * @brief Get new allocated flat string from vector.
+ *
+ * If l is not NULL, return length of the string.
+ * @param v Destination vector.
+ * @param l Length of the string.
+ * @return NULL at failed or NUL terminated new allocated string.
+ */
+static char *
+vector_str_get_flat(const struct vector_str *v, size_t *l)
+{
+ ssize_t elem_pos, elem_size, rtn_size;
+ size_t i;
+ char *rtn;
+
+ if (v == NULL || v->size == 0)
+ return (NULL);
+
+ if ((rtn_size = get_strlen_sum(v)) == 0)
+ return (NULL);
+
+ if ((rtn = malloc(sizeof(char) * (rtn_size + 1))) == NULL)
+ return (NULL);
+
+ elem_pos = 0;
+ for (i = 0; i < v->size; ++i) {
+ elem_size = strlen(v->container[i]);
+
+ memcpy(rtn + elem_pos, v->container[i], elem_size);
+
+ elem_pos += elem_size;
+ }
+
+ rtn[rtn_size] = '\0';
+
+ if (l != NULL)
+ *l = rtn_size;
+
+ return (rtn);
+}
+
+static bool
+vector_str_grow(struct vector_str *v)
+{
+ size_t i, tmp_cap;
+ char **tmp_ctn;
+
+ if (v == NULL)
+ return (false);
+
+ assert(v->capacity > 0);
+
+ tmp_cap = v->capacity * BUFFER_GROWFACTOR;
+
+ assert(tmp_cap > v->capacity);
+
+ if ((tmp_ctn = malloc(sizeof(char *) * tmp_cap)) == NULL)
+ return (false);
+
+ for (i = 0; i < v->size; ++i)
+ tmp_ctn[i] = v->container[i];
+
+ free(v->container);
+
+ v->container = tmp_ctn;
+ v->capacity = tmp_cap;
+
+ return (true);
+}
+
+/**
+ * @brief Initialize vector_str.
+ * @return false at failed, true at success.
+ */
+static bool
+vector_str_init(struct vector_str *v)
+{
+
+ if (v == NULL)
+ return (false);
+
+ v->size = 0;
+ v->capacity = VECTOR_DEF_CAPACITY;
+
+ assert(v->capacity > 0);
+
+ if ((v->container = malloc(sizeof(char *) * v->capacity)) == NULL)
+ return (false);
+
+ assert(v->container != NULL);
+
+ return (true);
+}
+
+/**
+ * @brief Remove last element in vector_str.
+ * @return false at failed, true at success.
+ */
+static bool
+vector_str_pop(struct vector_str *v)
+{
+
+ if (v == NULL)
+ return (false);
+
+ if (v->size == 0)
+ return (true);
+
+ --v->size;
+
+ free(v->container[v->size]);
+ v->container[v->size] = NULL;
+
+ return (true);
+}
+
+/**
+ * @brief Push back string to vector.
+ * @return false at failed, true at success.
+ */
+static bool
+vector_str_push(struct vector_str *v, const char *str, size_t len)
+{
+
+ if (v == NULL || str == NULL)
+ return (false);
+
+ if (v->size == v->capacity && vector_str_grow(v) == false)
+ return (false);
+
+ if ((v->container[v->size] = malloc(sizeof(char) * (len + 1))) == NULL)
+ return (false);
+
+ snprintf(v->container[v->size], len + 1, "%s", str);
+
+ ++v->size;
+
+ return (true);
+}
+
+/**
+ * @brief Push front org vector to det vector.
+ * @return false at failed, true at success.
+ */
+static bool
+vector_str_push_vector_head(struct vector_str *dst, struct vector_str *org)
+{
+ size_t i, j, tmp_cap;
+ char **tmp_ctn;
+
+ if (dst == NULL || org == NULL)
+ return (false);
+
+ tmp_cap = (dst->size + org->size) * BUFFER_GROWFACTOR;
+
+ if ((tmp_ctn = malloc(sizeof(char *) * tmp_cap)) == NULL)
+ return (false);
+
+ for (i = 0; i < org->size; ++i)
+ if ((tmp_ctn[i] = strdup(org->container[i])) == NULL) {
+ for (j = 0; j < i; ++j)
+ free(tmp_ctn[j]);
+
+ free(tmp_ctn);
+
+ return (false);
+ }
+
+ for (i = 0; i < dst->size; ++i)
+ tmp_ctn[i + org->size] = dst->container[i];
+
+ free(dst->container);
+
+ dst->container = tmp_ctn;
+ dst->capacity = tmp_cap;
+ dst->size += org->size;
+
+ return (true);
+}
+
+/**
+ * @brief Get new allocated flat string from vector between begin and end.
+ *
+ * If r_len is not NULL, string length will be returned.
+ * @return NULL at failed or NUL terminated new allocated string.
+ */
+static char *
+vector_str_substr(const struct vector_str *v, size_t begin, size_t end,
+ size_t *r_len)
+{
+ size_t cur, i, len;
+ char *rtn;
+
+ if (v == NULL || begin > end)
+ return (NULL);
+
+ len = 0;
+ for (i = begin; i < end + 1; ++i)
+ len += strlen(v->container[i]);
+
+ if ((rtn = malloc(sizeof(char) * (len + 1))) == NULL)
+ return (NULL);
+
+ if (r_len != NULL)
+ *r_len = len;
+
+ cur = 0;
+ for (i = begin; i < end + 1; ++i) {
+ len = strlen(v->container[i]);
+ memcpy(rtn + cur, v->container[i], len);
+ cur += len;
+ }
+ rtn[cur] = '\0';
+
+ return (rtn);
+}
+
static void cpp_demangle_data_dest(struct cpp_demangle_data *);
static int cpp_demangle_data_init(struct cpp_demangle_data *,
const char *);
@@ -152,7 +439,7 @@ static int vector_type_qualifier_init(struct vector_type_qualifier *);
static int vector_type_qualifier_push(struct vector_type_qualifier *,
enum type_qualifier);
-int cpp_demangle_gnu3_push_head;
+static int cpp_demangle_gnu3_push_head;
/**
* @brief Decode the input string by IA-64 C++ ABI style.
@@ -3042,22 +3329,6 @@ hex_to_dec(char c)
};
}
-/**
- * @brief Test input string is mangled by IA-64 C++ ABI style.
- *
- * Test string heads with "_Z" or "_GLOBAL__I_".
- * @return Return 0 at false.
- */
-bool
-is_cpp_mangled_gnu3(const char *org)
-{
- size_t len;
-
- len = strlen(org);
- return ((len > 2 && *org == '_' && *(org + 1) == 'Z') ||
- (len > 11 && !strncmp(org, "_GLOBAL__I_", 11)));
-}
-
static void
vector_read_cmd_dest(struct vector_read_cmd *v)
{
diff --git a/src/libelftc_vstr.c b/src/libelftc_vstr.c
deleted file mode 100644
index 57e4aff..0000000
--- a/src/libelftc_vstr.c
+++ /dev/null
@@ -1,315 +0,0 @@
-/*-
- * Copyright (c) 2008 Hyogeol Lee <hyogeollee@gmail.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer
- * in this position and unchanged.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/types.h>
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "_libelftc.h"
-
-/**
- * @file vector_str.c
- * @brief Dynamic vector data for string implementation.
- *
- * Resemble to std::vector<std::string> in C++.
- */
-
-static size_t get_strlen_sum(const struct vector_str *v);
-static bool vector_str_grow(struct vector_str *v);
-
-static size_t
-get_strlen_sum(const struct vector_str *v)
-{
- size_t i, len = 0;
-
- if (v == NULL)
- return (0);
-
- assert(v->size > 0);
-
- for (i = 0; i < v->size; ++i)
- len += strlen(v->container[i]);
-
- return (len);
-}
-
-/**
- * @brief Deallocate resource in vector_str.
- */
-void
-vector_str_dest(struct vector_str *v)
-{
- size_t i;
-
- if (v == NULL)
- return;
-
- for (i = 0; i < v->size; ++i)
- free(v->container[i]);
-
- free(v->container);
-}
-
-/**
- * @brief Find string in vector_str.
- * @param v Destination vector.
- * @param o String to find.
- * @param l Length of the string.
- * @return -1 at failed, 0 at not found, 1 at found.
- */
-int
-vector_str_find(const struct vector_str *v, const char *o, size_t l)
-{
- size_t i;
-
- if (v == NULL || o == NULL)
- return (-1);
-
- for (i = 0; i < v->size; ++i)
- if (strncmp(v->container[i], o, l) == 0)
- return (1);
-
- return (0);
-}
-
-/**
- * @brief Get new allocated flat string from vector.
- *
- * If l is not NULL, return length of the string.
- * @param v Destination vector.
- * @param l Length of the string.
- * @return NULL at failed or NUL terminated new allocated string.
- */
-char *
-vector_str_get_flat(const struct vector_str *v, size_t *l)
-{
- ssize_t elem_pos, elem_size, rtn_size;
- size_t i;
- char *rtn;
-
- if (v == NULL || v->size == 0)
- return (NULL);
-
- if ((rtn_size = get_strlen_sum(v)) == 0)
- return (NULL);
-
- if ((rtn = malloc(sizeof(char) * (rtn_size + 1))) == NULL)
- return (NULL);
-
- elem_pos = 0;
- for (i = 0; i < v->size; ++i) {
- elem_size = strlen(v->container[i]);
-
- memcpy(rtn + elem_pos, v->container[i], elem_size);
-
- elem_pos += elem_size;
- }
-
- rtn[rtn_size] = '\0';
-
- if (l != NULL)
- *l = rtn_size;
-
- return (rtn);
-}
-
-static bool
-vector_str_grow(struct vector_str *v)
-{
- size_t i, tmp_cap;
- char **tmp_ctn;
-
- if (v == NULL)
- return (false);
-
- assert(v->capacity > 0);
-
- tmp_cap = v->capacity * BUFFER_GROWFACTOR;
-
- assert(tmp_cap > v->capacity);
-
- if ((tmp_ctn = malloc(sizeof(char *) * tmp_cap)) == NULL)
- return (false);
-
- for (i = 0; i < v->size; ++i)
- tmp_ctn[i] = v->container[i];
-
- free(v->container);
-
- v->container = tmp_ctn;
- v->capacity = tmp_cap;
-
- return (true);
-}
-
-/**
- * @brief Initialize vector_str.
- * @return false at failed, true at success.
- */
-bool
-vector_str_init(struct vector_str *v)
-{
-
- if (v == NULL)
- return (false);
-
- v->size = 0;
- v->capacity = VECTOR_DEF_CAPACITY;
-
- assert(v->capacity > 0);
-
- if ((v->container = malloc(sizeof(char *) * v->capacity)) == NULL)
- return (false);
-
- assert(v->container != NULL);
-
- return (true);
-}
-
-/**
- * @brief Remove last element in vector_str.
- * @return false at failed, true at success.
- */
-bool
-vector_str_pop(struct vector_str *v)
-{
-
- if (v == NULL)
- return (false);
-
- if (v->size == 0)
- return (true);
-
- --v->size;
-
- free(v->container[v->size]);
- v->container[v->size] = NULL;
-
- return (true);
-}
-
-/**
- * @brief Push back string to vector.
- * @return false at failed, true at success.
- */
-bool
-vector_str_push(struct vector_str *v, const char *str, size_t len)
-{
-
- if (v == NULL || str == NULL)
- return (false);
-
- if (v->size == v->capacity && vector_str_grow(v) == false)
- return (false);
-
- if ((v->container[v->size] = malloc(sizeof(char) * (len + 1))) == NULL)
- return (false);
-
- snprintf(v->container[v->size], len + 1, "%s", str);
-
- ++v->size;
-
- return (true);
-}
-
-/**
- * @brief Push front org vector to det vector.
- * @return false at failed, true at success.
- */
-bool
-vector_str_push_vector_head(struct vector_str *dst, struct vector_str *org)
-{
- size_t i, j, tmp_cap;
- char **tmp_ctn;
-
- if (dst == NULL || org == NULL)
- return (false);
-
- tmp_cap = (dst->size + org->size) * BUFFER_GROWFACTOR;
-
- if ((tmp_ctn = malloc(sizeof(char *) * tmp_cap)) == NULL)
- return (false);
-
- for (i = 0; i < org->size; ++i)
- if ((tmp_ctn[i] = strdup(org->container[i])) == NULL) {
- for (j = 0; j < i; ++j)
- free(tmp_ctn[j]);
-
- free(tmp_ctn);
-
- return (false);
- }
-
- for (i = 0; i < dst->size; ++i)
- tmp_ctn[i + org->size] = dst->container[i];
-
- free(dst->container);
-
- dst->container = tmp_ctn;
- dst->capacity = tmp_cap;
- dst->size += org->size;
-
- return (true);
-}
-
-/**
- * @brief Get new allocated flat string from vector between begin and end.
- *
- * If r_len is not NULL, string length will be returned.
- * @return NULL at failed or NUL terminated new allocated string.
- */
-char *
-vector_str_substr(const struct vector_str *v, size_t begin, size_t end,
- size_t *r_len)
-{
- size_t cur, i, len;
- char *rtn;
-
- if (v == NULL || begin > end)
- return (NULL);
-
- len = 0;
- for (i = begin; i < end + 1; ++i)
- len += strlen(v->container[i]);
-
- if ((rtn = malloc(sizeof(char) * (len + 1))) == NULL)
- return (NULL);
-
- if (r_len != NULL)
- *r_len = len;
-
- cur = 0;
- for (i = begin; i < end + 1; ++i) {
- len = strlen(v->container[i]);
- memcpy(rtn + cur, v->container[i], len);
- cur += len;
- }
- rtn[cur] = '\0';
-
- return (rtn);
-}
diff --git a/src/typeinfo.cc b/src/typeinfo.cc
index 28af5c9..f5c254d 100644
--- a/src/typeinfo.cc
+++ b/src/typeinfo.cc
@@ -45,7 +45,6 @@ ABI_NAMESPACE::__pointer_to_member_type_info::~__pointer_to_member_type_info() {
// From libelftc
extern "C" char *cpp_demangle_gnu3(const char *);
-extern "C" bool is_cpp_mangled_gnu3(const char *);
/**
* Demangles a C++ symbol or type name. The buffer, if non-NULL, must be