Code gardening

REVIEWED: Some early returns, avoid if possible
REVIEWED: Some return variable names, for consistency, rename `success` to `result`
This commit is contained in:
Ray
2026-03-29 00:37:01 +01:00
parent 5fad835ff1
commit 8c44ea5032
7 changed files with 188 additions and 179 deletions

View File

@ -1949,7 +1949,7 @@ void UnloadMesh(Mesh mesh)
// Export mesh data to file
bool ExportMesh(Mesh mesh, const char *fileName)
{
bool success = false;
bool result = false;
if (IsFileExtension(fileName, ".obj"))
{
@ -2013,7 +2013,7 @@ bool ExportMesh(Mesh mesh, const char *fileName)
}
// NOTE: Text data length exported is determined by '\0' (NULL) character
success = SaveFileText(fileName, txtData);
result = SaveFileText(fileName, txtData);
RL_FREE(txtData);
}
@ -2022,13 +2022,13 @@ bool ExportMesh(Mesh mesh, const char *fileName)
// TODO: Support additional file formats to export mesh vertex data
}
return success;
return result;
}
// Export mesh as code file (.h) defining multiple arrays of vertex attributes
bool ExportMeshAsCode(Mesh mesh, const char *fileName)
{
bool success = false;
bool result = false;
#ifndef TEXT_BYTES_PER_LINE
#define TEXT_BYTES_PER_LINE 20
@ -2112,14 +2112,14 @@ bool ExportMeshAsCode(Mesh mesh, const char *fileName)
//-----------------------------------------------------------------------------------------
// NOTE: Text data size exported is determined by '\0' (NULL) character
success = SaveFileText(fileName, txtData);
result = SaveFileText(fileName, txtData);
RL_FREE(txtData);
//if (success != 0) TRACELOG(LOG_INFO, "FILEIO: [%s] Image as code exported successfully", fileName);
//if (result != 0) TRACELOG(LOG_INFO, "FILEIO: [%s] Image as code exported successfully", fileName);
//else TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to export image as code", fileName);
return success;
return result;
}
#if SUPPORT_FILEFORMAT_OBJ || SUPPORT_FILEFORMAT_MTL