diff options
| author | Ray <[email protected]> | 2023-10-17 11:09:56 +0200 |
|---|---|---|
| committer | Ray <[email protected]> | 2023-10-17 11:09:56 +0200 |
| commit | 99ede0f747f6d8a0b0f7d0d9371b9d46af16cb80 (patch) | |
| tree | b9ae41d1474d39f65dbd2acef80bf8841f4a4c54 /src/rtext.c | |
| parent | 7290ea9bfbccd62ab5e4870ca84868c2aecf5382 (diff) | |
| download | raylib-99ede0f747f6d8a0b0f7d0d9371b9d46af16cb80.tar.gz raylib-99ede0f747f6d8a0b0f7d0d9371b9d46af16cb80.zip | |
Added some notes for alternative implementations #3362
Diffstat (limited to 'src/rtext.c')
| -rw-r--r-- | src/rtext.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/rtext.c b/src/rtext.c index 2d72bbe6..5b43bfb9 100644 --- a/src/rtext.c +++ b/src/rtext.c @@ -1344,10 +1344,12 @@ Rectangle GetGlyphAtlasRec(Font font, int codepoint) // Get text length in bytes, check for \0 character unsigned int TextLength(const char *text) { - unsigned int length = 0; //strlen(text) + unsigned int length = 0; if (text != NULL) { + // NOTE: Alternative: use strlen(text) + while (*text++) length++; } @@ -1415,6 +1417,8 @@ int TextCopy(char *dst, const char *src) if ((src != NULL) && (dst != NULL)) { + // NOTE: Alternative: use strcpy(dst, src) + while (*src != '\0') { *dst = *src; @@ -1459,6 +1463,8 @@ const char *TextSubtext(const char *text, int position, int length) } if (length >= textLength) length = textLength; + + // NOTE: Alternative: memcpy(buffer, text + position, length) for (int c = 0 ; c < length ; c++) { |
