diff options
author | Kevin Newton <[email protected]> | 2024-06-05 13:47:00 -0400 |
---|---|---|
committer | Kevin Newton <[email protected]> | 2024-06-05 14:40:03 -0400 |
commit | ac70dd07e68384bf5e271dae7e8f08e7a64df1a1 (patch) | |
tree | a3ac3a792fdfa2a97d6c91f3b2642803dac23b02 | |
parent | ad438623e8f4e90b7d6567c6c552be89d080dcca (diff) |
[ruby/prism] Remove unused string list struct
https://github.com/ruby/prism/commit/36c6851c85
-rw-r--r-- | lib/prism/prism.gemspec | 2 | ||||
-rw-r--r-- | prism/regexp.h | 1 | ||||
-rw-r--r-- | prism/util/pm_string_list.c | 28 | ||||
-rw-r--r-- | prism/util/pm_string_list.h | 44 |
4 files changed, 0 insertions, 75 deletions
diff --git a/lib/prism/prism.gemspec b/lib/prism/prism.gemspec index b4504dbf4b..8a42224886 100644 --- a/lib/prism/prism.gemspec +++ b/lib/prism/prism.gemspec @@ -65,7 +65,6 @@ Gem::Specification.new do |spec| "include/prism/util/pm_newline_list.h", "include/prism/util/pm_strncasecmp.h", "include/prism/util/pm_string.h", - "include/prism/util/pm_string_list.h", "include/prism/util/pm_strpbrk.h", "include/prism/version.h", "lib/prism.rb", @@ -148,7 +147,6 @@ Gem::Specification.new do |spec| "src/util/pm_list.c", "src/util/pm_memchr.c", "src/util/pm_newline_list.c", - "src/util/pm_string_list.c", "src/util/pm_string.c", "src/util/pm_strncasecmp.c", "src/util/pm_strpbrk.c" diff --git a/prism/regexp.h b/prism/regexp.h index ca5185d2fd..7245cbd34e 100644 --- a/prism/regexp.h +++ b/prism/regexp.h @@ -10,7 +10,6 @@ #include "prism/parser.h" #include "prism/encoding.h" #include "prism/util/pm_memchr.h" -#include "prism/util/pm_string_list.h" #include "prism/util/pm_string.h" #include <stdbool.h> diff --git a/prism/util/pm_string_list.c b/prism/util/pm_string_list.c deleted file mode 100644 index f6c2145987..0000000000 --- a/prism/util/pm_string_list.c +++ /dev/null @@ -1,28 +0,0 @@ -#include "prism/util/pm_string_list.h" - -/** - * Append a pm_string_t to the given string list. - */ -void -pm_string_list_append(pm_string_list_t *string_list, pm_string_t *string) { - if (string_list->length + 1 > string_list->capacity) { - if (string_list->capacity == 0) { - string_list->capacity = 1; - } else { - string_list->capacity *= 2; - } - - string_list->strings = xrealloc(string_list->strings, string_list->capacity * sizeof(pm_string_t)); - if (string_list->strings == NULL) abort(); - } - - string_list->strings[string_list->length++] = *string; -} - -/** - * Free the memory associated with the string list - */ -void -pm_string_list_free(pm_string_list_t *string_list) { - xfree(string_list->strings); -} diff --git a/prism/util/pm_string_list.h b/prism/util/pm_string_list.h deleted file mode 100644 index 0d406cc5d8..0000000000 --- a/prism/util/pm_string_list.h +++ /dev/null @@ -1,44 +0,0 @@ -/** - * @file pm_string_list.h - * - * A list of strings. - */ -#ifndef PRISM_STRING_LIST_H -#define PRISM_STRING_LIST_H - -#include "prism/defines.h" -#include "prism/util/pm_string.h" - -#include <stddef.h> -#include <stdlib.h> - -/** - * A list of strings. - */ -typedef struct { - /** The length of the string list. */ - size_t length; - - /** The capacity of the string list that has been allocated. */ - size_t capacity; - - /** A pointer to the start of the string list. */ - pm_string_t *strings; -} pm_string_list_t; - -/** - * Append a pm_string_t to the given string list. - * - * @param string_list The string list to append to. - * @param string The string to append. - */ -void pm_string_list_append(pm_string_list_t *string_list, pm_string_t *string); - -/** - * Free the memory associated with the string list. - * - * @param string_list The string list to free. - */ -PRISM_EXPORTED_FUNCTION void pm_string_list_free(pm_string_list_t *string_list); - -#endif |