mirror of
https://github.com/janet-lang/janet
synced 2025-02-23 19:50:02 +00:00
Use libc strlen in janet_buffer_push_cstring
Platform libc's often contains optimized assembly implementations of strlen, so take advantage of them here instead of doing a naive count.
This commit is contained in:
parent
2ea2e72ddd
commit
045c80869d
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user