suffix_list.c

Tue, 20 Sep 2011 15:19:28 +0200

author
Mike Becker <universe@uap-core.de>
date
Tue, 20 Sep 2011 15:19:28 +0200
changeset 16
bc9a0fefd892
parent 11
06cbd0ec003d
child 17
5f43f733cc12
permissions
-rw-r--r--

fixed makefile to run safely on compile errors + added -V option to cline

     1 /*
     2  * suffix_list.c
     3  *
     4  *  Created on: 15.09.2011
     5  *      Author: beckermi
     6  */
     8 #include "suffix_list.h"
    10 suffix_list_t* new_suffix_list_t() {
    11   suffix_list_t* suffixList = malloc(sizeof(suffix_list_t));
    12   suffixList->count = 0;
    13   suffixList->items = NULL;
    15   return suffixList;
    16 }
    18 void add_suffix(suffix_list_t* list, char* item) {
    19   char** reallocated_list =
    20     realloc(list->items, sizeof(char*) * list->count + 1);
    21   if (reallocated_list != NULL) {
    22     list->items = reallocated_list;
    23     list->items[list->count] = item;
    24     list->count++;
    25   }
    26 }

mercurial