diff options
| author | Ray <raysan5@gmail.com> | 2019-02-28 18:39:58 +0100 |
|---|---|---|
| committer | Ray <raysan5@gmail.com> | 2019-02-28 18:39:58 +0100 |
| commit | d679a97e926dce81ed64dc40612b6ac8f78ea264 (patch) | |
| tree | 6a188780842e38811b3bf4d13a3a46b7cf39b3e3 /src | |
| parent | 5735f13fe54ba1170005e3973c95728d7b29ac89 (diff) | |
| download | raylib-d679a97e926dce81ed64dc40612b6ac8f78ea264.tar.gz raylib-d679a97e926dce81ed64dc40612b6ac8f78ea264.zip | |
Removed some NULL pointer checks
Diffstat (limited to 'src')
| -rw-r--r-- | src/rlgl.h | 24 | ||||
| -rw-r--r-- | src/textures.c | 7 |
2 files changed, 14 insertions, 17 deletions
@@ -2727,18 +2727,18 @@ void rlDrawMesh(Mesh mesh, Material material, Matrix transform) // Unload mesh data from CPU and GPU void rlUnloadMesh(Mesh *mesh) { - if (mesh->vertices != NULL) free(mesh->vertices); - if (mesh->texcoords != NULL) free(mesh->texcoords); - if (mesh->normals != NULL) free(mesh->normals); - if (mesh->colors != NULL) free(mesh->colors); - if (mesh->tangents != NULL) free(mesh->tangents); - if (mesh->texcoords2 != NULL) free(mesh->texcoords2); - if (mesh->indices != NULL) free(mesh->indices); - - if (mesh->baseVertices != NULL) free(mesh->baseVertices); - if (mesh->baseNormals != NULL) free(mesh->baseNormals); - if (mesh->weightBias != NULL) free(mesh->weightBias); - if (mesh->weightId != NULL) free(mesh->weightId); + free(mesh->vertices); + free(mesh->texcoords); + free(mesh->normals); + free(mesh->colors); + free(mesh->tangents); + free(mesh->texcoords2); + free(mesh->indices); + + free(mesh->baseVertices); + free(mesh->baseNormals); + free(mesh->weightBias); + free(mesh->weightId); rlDeleteBuffers(mesh->vboId[0]); // vertex rlDeleteBuffers(mesh->vboId[1]); // texcoords diff --git a/src/textures.c b/src/textures.c index d79cb3cb..01c9b2f5 100644 --- a/src/textures.c +++ b/src/textures.c @@ -353,7 +353,7 @@ Image LoadImageRaw(const char *fileName, int width, int height, int format, int { TraceLog(LOG_WARNING, "[%s] RAW image data can not be read, wrong requested format or size", fileName); - if (image.data != NULL) free(image.data); + free(image.data); } else { @@ -414,10 +414,7 @@ RenderTexture2D LoadRenderTexture(int width, int height) // Unload image from CPU memory (RAM) void UnloadImage(Image image) { - if (image.data != NULL) free(image.data); - - // NOTE: It becomes anoying every time a texture is loaded - //TraceLog(LOG_INFO, "Unloaded image data"); + free(image.data); } // Unload texture from GPU memory (VRAM) |
