From 3b25732cf694afa106099db29132dee507f189cb Mon Sep 17 00:00:00 2001 From: Ruan Montelo Date: Sun, 12 Mar 2023 19:10:29 -0300 Subject: [PATCH] Changed the usage of sizeof({type}) to sizeof({variable}) to avoid problems in the future when changing variable types --- Findin C/Main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Findin C/Main.c b/Findin C/Main.c index 21106c5..4b77e14 100644 --- a/Findin C/Main.c +++ b/Findin C/Main.c @@ -159,7 +159,7 @@ size_t FindIn(char* search, char* filePath, char* subDirectoryToShow) { lineSize++; if (line == 0) { - line = malloc(sizeof(char) + 1); + line = malloc(sizeof(c) + 1); if (line == 0) { exit(1); @@ -171,7 +171,7 @@ size_t FindIn(char* search, char* filePath, char* subDirectoryToShow) { } else { char* oldLineBuffer = line; - line = realloc(line, sizeof(char) * (lineSize + 1)); + line = realloc(line, sizeof(c) * (lineSize + 1)); if (line == 0) { free(oldLineBuffer);