summaryrefslogtreecommitdiffhomepage
path: root/src/text.c
diff options
context:
space:
mode:
authorRay <[email protected]>2021-05-30 11:50:32 +0200
committerRay <[email protected]>2021-05-30 11:50:32 +0200
commit0369ec9adf5c6f4838a74e29e049ebc4e3aab14f (patch)
tree3ffd03066df609c0c8a17da90eacb81cd966a2a5 /src/text.c
parentc828e481fbee9846721552cb37250a93332ee115 (diff)
downloadraylib-0369ec9adf5c6f4838a74e29e049ebc4e3aab14f.tar.gz
raylib-0369ec9adf5c6f4838a74e29e049ebc4e3aab14f.zip
Some code tweaks
Diffstat (limited to 'src/text.c')
-rw-r--r--src/text.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/text.c b/src/text.c
index 23cad7e8..2627e99e 100644
--- a/src/text.c
+++ b/src/text.c
@@ -1272,7 +1272,7 @@ const char *TextSubtext(const char *text, int position, int length)
// Replace text string
// REQUIRES: strstr(), strncpy(), strcpy()
-// WARNING: Internally allocated memory must be freed by the user (if return != NULL)
+// WARNING: Returned buffer must be freed by the user (if return != NULL)
char *TextReplace(char *text, const char *replace, const char *by)
{
// Sanity checks and initialization
@@ -1297,14 +1297,14 @@ char *TextReplace(char *text, const char *replace, const char *by)
for (count = 0; (temp = strstr(insertPoint, replace)); count++) insertPoint = temp + replaceLen;
// Allocate returning string and point temp to it
- temp = result = RL_MALLOC(TextLength(text) + (byLen - replaceLen)*count + 1);
+ temp = result = (char *)RL_MALLOC(TextLength(text) + (byLen - replaceLen)*count + 1);
if (!result) return NULL; // Memory could not be allocated
// First time through the loop, all the variable are set correctly from here on,
- // temp points to the end of the result string
- // insertPoint points to the next occurrence of replace in text
- // text points to the remainder of text after "end of replace"
+ // - 'temp' points to the end of the result string
+ // - 'insertPoint' points to the next occurrence of replace in text
+ // - 'text' points to the remainder of text after "end of replace"
while (count--)
{
insertPoint = strstr(text, replace);