ansilove

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

commit 4c3f89b544e9a7a78255111874ac21c1bbaa9ef2
parent 5965edf1518227b5e25cb525778eb4e342ecaf98
Author: Frederic Cambus <fred@statdns.com>
Date:   Mon, 30 Dec 2019 10:41:38 +0100

Do not use typedef from the sauce struct.

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

diff --git a/src/ansilove.c b/src/ansilove.c @@ -186,7 +186,7 @@ main(int argc, char *argv[]) messages = stdout; /* let's check the file for a valid SAUCE record */ - sauce *record = sauceReadFileName(input); + struct sauce *record = sauceReadFileName(input); /* record == NULL also means there is no file, we can stop here */ if (record == NULL) { diff --git a/src/sauce.c b/src/sauce.c @@ -19,7 +19,7 @@ #include "sauce.h" /* Reads SAUCE via a filename. */ -sauce * +struct sauce * sauceReadFileName(char *fileName) { FILE *file = fopen(fileName, "r"); @@ -27,16 +27,16 @@ sauceReadFileName(char *fileName) return NULL; } - sauce *record = sauceReadFile(file); + struct sauce *record = sauceReadFile(file); fclose(file); return record; } /* Read SAUCE via a FILE pointer. */ -sauce * +struct sauce * sauceReadFile(FILE *file) { - sauce *record; + struct sauce *record; record = malloc(sizeof *record); memset(record, 0, sizeof *record); @@ -47,7 +47,7 @@ sauceReadFile(FILE *file) } void -readRecord(FILE *file, sauce *record) +readRecord(FILE *file, struct sauce *record) { if (fseek(file, 0 - RECORD_SIZE, SEEK_END) != 0) { return; diff --git a/src/sauce.h b/src/sauce.h @@ -22,7 +22,7 @@ #define SAUCE_ID "SAUCE" #define COMMENT_ID "COMNT" -typedef struct { +struct sauce { char ID[6]; char version[3]; char title[36]; @@ -40,11 +40,11 @@ typedef struct { unsigned char flags; char tinfos[23]; char **comment_lines; -} sauce; +}; -sauce *sauceReadFileName(char *); -sauce *sauceReadFile(FILE *); -void readRecord(FILE *, sauce *); -int readComments(FILE *, char **, int32_t); +struct sauce *sauceReadFileName(char *); +struct sauce *sauceReadFile(FILE *); +void readRecord(FILE *, struct sauce *); +int readComments(FILE *, char **, int32_t); #endif /* SAUCE_H */