diary

Text-based journaling program
git clone https://git.in0rdr.ch/diary.git
Log | Files | Refs | README | LICENSE

commit f96c3d7c3c87d597a2f87b0b0123dfd2b51423d1
parent 93c7fdb8f9963dab8a15a20e9519f51753a4311f
Author: Andreas Gruhler <agruhl@gmx.ch>
Date:   Wed, 29 Dec 2021 23:04:10 +0100

refactor(display_entry): rename vars

Diffstat:
Msrc/diary.c | 12++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/diary.c b/src/diary.c @@ -92,7 +92,7 @@ void display_entry(const char* dir, size_t dir_size, const struct tm* date, WIND int fdm, fds; char* pts = ""; - size_t entrys, indents; + size_t entry_size, indent_size; // formatted entry char* entry = calloc(1, sizeof(char)); @@ -186,11 +186,11 @@ void display_entry(const char* dir, size_t dir_size, const struct tm* date, WIND // advance row number in indent sprintf(indent, "\033[%d;%dH", row++, ASIDE_WIDTH + CAL_WIDTH + 1); - entrys = strlen(entry); - indents = strlen(indent); + entry_size = strlen(entry); + indent_size = strlen(indent); // execvp does not return, store all lines in entry buffer - entryr = realloc(entry, entrys + indents + strlen(line) + 1); + entryr = realloc(entry, entry_size + indent_size + strlen(line) + 1); if (entryr == NULL) { perror("failed to realloc entry buffer"); break; @@ -198,9 +198,9 @@ void display_entry(const char* dir, size_t dir_size, const struct tm* date, WIND // entry ptr already freed by realloc if moved entry = (char*) entryr; // append indent to entry buffer - strcat(entry + entrys, indent); + strcat(entry + entry_size, indent); // append line to entry buffer - strcat(entry + entrys + indents, line); + strcat(entry + entry_size + indent_size, line); } }