ansilove

ANSI and ASCII art to PNG converter in C
Log | Files | Refs | README | LICENSE

commit 09afe25d62295c1f2affcb039e13b8254eae874e
parent e84cb649d1322012a06fbf7397377257a6032297
Author: Frederic Cambus <fred@statdns.com>
Date:   Fri, 19 Oct 2018 13:38:47 +0200

Change return type of readComments() to allow returning error codes

Diffstat:
Msrc/sauce.c | 12++++++------
Msrc/sauce.h | 2+-
2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/sauce.c b/src/sauce.c @@ -89,7 +89,7 @@ void readRecord(FILE *file, sauce *record) } } -void readComments(FILE *file, char **comment_lines, int32_t comments) +int readComments(FILE *file, char **comment_lines, int32_t comments) { int32_t i; @@ -100,7 +100,7 @@ void readComments(FILE *file, char **comment_lines, int32_t comments) if (strcmp(ID, COMMENT_ID) != 0) { free(comment_lines); - return; + return -1; } for (i = 0; i < comments; i++) { @@ -113,15 +113,15 @@ void readComments(FILE *file, char **comment_lines, int32_t comments) comment_lines[i] = strdup(buf); if (comment_lines[i] == NULL) { free(comment_lines); - return; + return -1; } } else { free(comment_lines); - return; + return -1; } } - return; + return 0; } free(comment_lines); - return; + return -1; } diff --git a/src/sauce.h b/src/sauce.h @@ -47,6 +47,6 @@ typedef struct { sauce *sauceReadFileName(char *fileName); sauce *sauceReadFile(FILE *file); void readRecord(FILE *file, sauce *record); -void readComments(FILE *file, char **comment_lines, int32_t comments); +int readComments(FILE *file, char **comment_lines, int32_t comments); #endif