diff options
| author | raysan5 <[email protected]> | 2020-05-23 19:23:40 +0200 |
|---|---|---|
| committer | raysan5 <[email protected]> | 2020-05-23 19:23:40 +0200 |
| commit | 94789dd24a931e3659360aa6ffd587b4523a3b98 (patch) | |
| tree | d4b68f7d302d8145ab1728fc7a3fb72ad663a3f1 /src/utils.c | |
| parent | b95673f70191244dd88be2b7ad0b401d86972650 (diff) | |
| download | raylib-94789dd24a931e3659360aa6ffd587b4523a3b98.tar.gz raylib-94789dd24a931e3659360aa6ffd587b4523a3b98.zip | |
Review usage of sizeof(), unify conventions
All functions requiring sizeof() now follow the same convention:
NUM_ELEMENTS*NUM_SUBELEMENTS*sizeof()
Diffstat (limited to 'src/utils.c')
| -rw-r--r-- | src/utils.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/utils.c b/src/utils.c index c64144a6..7b1d9ee4 100644 --- a/src/utils.c +++ b/src/utils.c @@ -183,7 +183,7 @@ unsigned char *LoadFileData(const char *fileName, unsigned int *bytesRead) if (size > 0) { - data = (unsigned char *)RL_MALLOC(sizeof(unsigned char)*size); + data = (unsigned char *)RL_MALLOC(size*sizeof(unsigned char)); // NOTE: fread() returns number of read elements instead of bytes, so we read [1 byte, size elements] unsigned int count = (unsigned int)fread(data, sizeof(unsigned char), size, file); @@ -246,7 +246,7 @@ char *LoadFileText(const char *fileName) if (size > 0) { - text = (char *)RL_MALLOC(sizeof(char)*(size + 1)); + text = (char *)RL_MALLOC((size + 1)*sizeof(char)); unsigned int count = (unsigned int)fread(text, sizeof(char), size, textFile); // WARNING: \r\n is converted to \n on reading, so, |
