string_list.c

changeset 34
fa9bda32de17
parent 33
1a2d7298bc82
child 35
35120de6ee53
     1.1 --- a/string_list.c	Tue Oct 02 10:49:25 2012 +0200
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,34 +0,0 @@
     1.4 -/*
     1.5 - * string_list.c
     1.6 - *
     1.7 - *  Created on: 15.09.2011
     1.8 - *      Author: Mike
     1.9 - */
    1.10 -
    1.11 -#include "string_list.h"
    1.12 -
    1.13 -string_list_t* new_string_list_t() {
    1.14 -  string_list_t* stringList = malloc(sizeof(string_list_t));
    1.15 -  stringList->count = 0;
    1.16 -  stringList->items = NULL;
    1.17 -
    1.18 -  return stringList;
    1.19 -}
    1.20 -
    1.21 -void destroy_string_list_t(string_list_t* list) {
    1.22 -  if (list->items != NULL) {
    1.23 -    free(list->items);
    1.24 -  }
    1.25 -  free(list);
    1.26 -}
    1.27 -
    1.28 -void add_string(string_list_t* list, char* item) {
    1.29 -  char** reallocated_list =
    1.30 -    realloc(list->items, sizeof(char*) * (list->count + 1));
    1.31 -  if (reallocated_list != NULL) {
    1.32 -    list->items = reallocated_list;
    1.33 -    list->items[list->count] = item;
    1.34 -    list->count++;
    1.35 -  }
    1.36 -}
    1.37 -

mercurial