diff options
author | pommicket <pommicket@gmail.com> | 2023-10-18 12:58:59 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-10-18 12:58:59 -0400 |
commit | 4d57539ffc2954e5c3b9c42da41511f69c4fcde9 (patch) | |
tree | db691445e296448deb2aa55cef6acb04a256b2ee /util.c | |
parent | 29282f362d5f663ec3da17b135751f3b9b2bd0fd (diff) |
start editorconfig support
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -38,6 +38,12 @@ void rc_str_incref(RcStr *str) { str->ref_count += 1; } + +RcStr *rc_str_copy(RcStr *str) { + rc_str_incref(str); + return str; +} + void rc_str_decref(RcStr **pstr) { RcStr *const str = *pstr; if (!str) return; @@ -300,6 +306,13 @@ void str_trim(char *str) { str_trim_start(str); } +void str_ascii_to_lowercase(char *str) { + for (char *p = str; *p; p++) { + if (*p > 0 && *p < 127) + *p = (char)tolower(*p); + } +} + size_t str_count_char(const char *s, char c) { const char *p = s; size_t count = 0; |