[ruby/prism] Remove unused string list struct

https://github.com/ruby/prism/commit/36c6851c85
This commit is contained in:
Kevin Newton 2024-06-05 13:47:00 -04:00
parent ad438623e8
commit ac70dd07e6
4 changed files with 0 additions and 75 deletions

View File

@ -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"

View File

@ -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>

View File

@ -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);
}

View File

@ -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