summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-10-18 12:58:59 -0400
committerpommicket <pommicket@gmail.com>2023-10-18 12:58:59 -0400
commit4d57539ffc2954e5c3b9c42da41511f69c4fcde9 (patch)
treedb691445e296448deb2aa55cef6acb04a256b2ee /util.c
parent29282f362d5f663ec3da17b135751f3b9b2bd0fd (diff)
start editorconfig support
Diffstat (limited to 'util.c')
-rw-r--r--util.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/util.c b/util.c
index 1649f91..b86a4ca 100644
--- a/util.c
+++ b/util.c
@@ -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;