Sha256: ca18712ab89090e9b5deadcad5f1224faa23057539ee667a847aab7e8904a57a

Contents?: true

Size: 767 Bytes

Versions: 4

Compression:

Stored size: 767 Bytes

Contents

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
prism-0.28.0 src/util/pm_string_list.c
prism-0.27.0 src/util/pm_string_list.c
prism-0.26.0 src/util/pm_string_list.c
prism-0.25.0 src/util/pm_string_list.c