First stage of splitting up a source line complete. Next is tokenizing the list of string being generated.
This commit is contained in:
+4
-3
@@ -1,7 +1,4 @@
|
||||
#include "../includes/list.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
List* CreateList() {
|
||||
List *new = malloc(sizeof(List));
|
||||
@@ -13,6 +10,7 @@ List* CreateList() {
|
||||
}
|
||||
|
||||
int AddListItem(char *value, List* list) {
|
||||
if (list == NULL) return -1;
|
||||
|
||||
if (list->capacity < list->size + 1) {
|
||||
list->root = realloc(list->root, sizeof(char*) * list->capacity * 2);
|
||||
@@ -31,6 +29,8 @@ int AddListItem(char *value, List* list) {
|
||||
}
|
||||
|
||||
void PrintList(List* list) {
|
||||
if (list == NULL) return;
|
||||
|
||||
List *current = list;
|
||||
|
||||
printf("Size: %d; Capacity: %d\n", list->size, list->capacity);
|
||||
@@ -41,6 +41,7 @@ void PrintList(List* list) {
|
||||
}
|
||||
|
||||
void DestroyList(List* list) {
|
||||
if (list == NULL) return;
|
||||
|
||||
for(int i = 0; i < list->size; i++) {
|
||||
free(list->root[i]);
|
||||
|
||||
Reference in New Issue
Block a user