suffix_list.c

Fri, 16 Sep 2011 09:14:59 +0200

author
Mike Becker <universe@uap-core.de>
date
Fri, 16 Sep 2011 09:14:59 +0200
changeset 12
902cb8d2053c
parent 11
06cbd0ec003d
child 17
5f43f733cc12
permissions
-rw-r--r--

removed dynamic programm name

/*
 * suffix_list.c
 *
 *  Created on: 15.09.2011
 *      Author: beckermi
 */

#include "suffix_list.h"

suffix_list_t* new_suffix_list_t() {
  suffix_list_t* suffixList = malloc(sizeof(suffix_list_t));
  suffixList->count = 0;
  suffixList->items = NULL;

  return suffixList;
}

void add_suffix(suffix_list_t* list, char* item) {
  char** reallocated_list =
    realloc(list->items, sizeof(char*) * list->count + 1);
  if (reallocated_list != NULL) {
    list->items = reallocated_list;
    list->items[list->count] = item;
    list->count++;
  }
}

mercurial