From 03710c9d8ea5acb04445ce3d125b58da043df6ed Mon Sep 17 00:00:00 2001 From: Ray Date: Sat, 22 May 2021 16:54:04 +0200 Subject: Some code tweaks for consistency --- src/core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/core.c') diff --git a/src/core.c b/src/core.c index c5924595..e84d82c4 100644 --- a/src/core.c +++ b/src/core.c @@ -2179,8 +2179,8 @@ Shader LoadShader(const char *vsFileName, const char *fsFileName) shader.id = rlLoadShaderCode(vShaderStr, fShaderStr); - if (vShaderStr != NULL) RL_FREE(vShaderStr); - if (fShaderStr != NULL) RL_FREE(fShaderStr); + if (vShaderStr != NULL) UnloadFileText(vShaderStr); + if (fShaderStr != NULL) UnloadFileText(fShaderStr); // After shader loading, we TRY to set default location names if (shader.id > 0) @@ -2801,8 +2801,8 @@ char **GetDirectoryFiles(const char *dirPath, int *fileCount) ClearDirectoryFiles(); // Memory allocation for MAX_DIRECTORY_FILES - dirFilesPath = (char **)RL_MALLOC(sizeof(char *)*MAX_DIRECTORY_FILES); - for (int i = 0; i < MAX_DIRECTORY_FILES; i++) dirFilesPath[i] = (char *)RL_MALLOC(sizeof(char)*MAX_FILEPATH_LENGTH); + dirFilesPath = (char **)RL_MALLOC(MAX_DIRECTORY_FILES*sizeof(char *)); + for (int i = 0; i < MAX_DIRECTORY_FILES; i++) dirFilesPath[i] = (char *)RL_MALLOC(MAX_FILEPATH_LENGTH*sizeof(char)); int counter = 0; struct dirent *entity; @@ -5151,11 +5151,11 @@ static void WindowDropCallback(GLFWwindow *window, int count, const char **paths { ClearDroppedFiles(); - CORE.Window.dropFilesPath = (char **)RL_MALLOC(sizeof(char *)*count); + CORE.Window.dropFilesPath = (char **)RL_MALLOC(count*sizeof(char *)); for (int i = 0; i < count; i++) { - CORE.Window.dropFilesPath[i] = (char *)RL_MALLOC(sizeof(char)*MAX_FILEPATH_LENGTH); + CORE.Window.dropFilesPath[i] = (char *)RL_MALLOC(MAX_FILEPATH_LENGTH*sizeof(char)); strcpy(CORE.Window.dropFilesPath[i], paths[i]); } -- cgit v1.2.3