mirror of
https://github.com/theoludwig/libcproject.git
synced 2025-05-21 23:21:15 +02:00
perf: mutate strings instead of copy when possible
BREAKING CHANGE: Most of string functions mutates the string instead of copying now. This allows better performance when copy is not needed. It also allows more granual control. If copy is wanted, simply use `string_copy` before calling the function. Impacted functions are: `string_to_uppercase`, `string_to_lowercase`, `string_replace`, `string_trim_start`, `string_trim_end`, `string_trim`, `string_capitalize`, `string_reverse`
This commit is contained in:
6
main.c
6
main.c
@ -4,8 +4,8 @@
|
||||
#include "libcproject.h"
|
||||
|
||||
int main() {
|
||||
string_t string_value = "Hello, world!";
|
||||
printf("%s\n", string_value);
|
||||
printf("string_length = %ld\n", string_get_length(string_value));
|
||||
string_t string = "Hello, world!";
|
||||
printf("%s\n", string);
|
||||
printf("string_length = %ld\n", string_get_length(string));
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
Reference in New Issue
Block a user