diff options
| author | Ray <[email protected]> | 2021-05-22 16:54:04 +0200 |
|---|---|---|
| committer | Ray <[email protected]> | 2021-05-22 16:54:04 +0200 |
| commit | 03710c9d8ea5acb04445ce3d125b58da043df6ed (patch) | |
| tree | 6e695068b1f5e34972dbb1b2196540007c5d49ca /src/core.c | |
| parent | cb698dd37db805a7d33445c22d6077fc35cf288d (diff) | |
| download | raylib-03710c9d8ea5acb04445ce3d125b58da043df6ed.tar.gz raylib-03710c9d8ea5acb04445ce3d125b58da043df6ed.zip | |
Some code tweaks for consistency
Diffstat (limited to 'src/core.c')
| -rw-r--r-- | src/core.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -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]); } |
