Sha256: 6a6cec16d4e9cf8ee3685d502e550729881c786a44fdfd96bee84952da469684
Contents?: true
Size: 1005 Bytes
Versions: 4
Compression:
Stored size: 1005 Bytes
Contents
#include "yarp/util/yp_string_list.h" // Allocate a new yp_string_list_t. yp_string_list_t * yp_string_list_alloc(void) { return (yp_string_list_t *) malloc(sizeof(yp_string_list_t)); } // Initialize a yp_string_list_t with its default values. void yp_string_list_init(yp_string_list_t *string_list) { string_list->strings = (yp_string_t *) malloc(sizeof(yp_string_t)); string_list->length = 0; string_list->capacity = 1; } // Append a yp_string_t to the given string list. void yp_string_list_append(yp_string_list_t *string_list, yp_string_t *string) { if (string_list->length + 1 > string_list->capacity) { string_list->capacity *= 2; string_list->strings = (yp_string_t *) realloc(string_list->strings, string_list->capacity * sizeof(yp_string_t)); } string_list->strings[string_list->length++] = *string; } // Free the memory associated with the string list. void yp_string_list_free(yp_string_list_t *string_list) { free(string_list->strings); }
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
yarp-0.9.0 | src/util/yp_string_list.c |
yarp-0.8.0 | src/util/yp_string_list.c |
yarp-0.7.0 | src/util/yp_string_list.c |
yarp-0.6.0 | src/util/yp_string_list.c |