Merge pull request #1314 from williewillus/pr1314

Use libc strlen in janet_buffer_push_cstring
This commit is contained in:
Calvin Rose 2023-10-20 15:41:29 -07:00 committed by GitHub
commit 46b34833c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -135,8 +135,7 @@ void janet_buffer_extra(JanetBuffer *buffer, int32_t n) {
/* Push a cstring to buffer */
void janet_buffer_push_cstring(JanetBuffer *buffer, const char *cstring) {
int32_t len = 0;
while (cstring[len]) ++len;
int32_t len = strlen(cstring);
janet_buffer_push_bytes(buffer, (const uint8_t *) cstring, len);
}