Implemented responses

This commit is contained in:
Nate Choe
2022-01-22 19:54:03 -06:00
parent 55da97269b
commit ad06bbc7be
8 changed files with 214 additions and 54 deletions

View File

@@ -71,6 +71,13 @@ static ReturnCode getToken(FILE *file, char **ret) {
*ret = malloc(allocatedLen);
for (len = 0;; len++) {
if (len >= allocatedLen) {
allocatedLen *= 2;
char *newret = realloc(*ret, allocatedLen);
if (newret == NULL)
goto error;
*ret = newret;
}
int c = fgetc(file);
switch (type) {
case QUOTED:
@@ -95,13 +102,6 @@ static ReturnCode getToken(FILE *file, char **ret) {
goto gotToken;
goto error;
}
if (len >= allocatedLen) {
allocatedLen *= 2;
char *newret = realloc(*ret, allocatedLen);
if (newret == NULL)
goto error;
*ret = newret;
}
(*ret)[len] = c;
}
gotToken: