summaryrefslogtreecommitdiff
path: root/shared/util.c
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-06-07 21:27:16 +0200
committerlonkaars <loek@pipeframe.xyz>2022-06-07 21:27:16 +0200
commit3e65c70da770fa31fc8acc6ab9374d908cf1ed17 (patch)
tree14f8d4c708faccc8b3f992a022f940c00ed694f9 /shared/util.c
parent8c8322a7a0c251d595a0df054324f82d41966e0a (diff)
implement orders
Diffstat (limited to 'shared/util.c')
-rw-r--r--shared/util.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/shared/util.c b/shared/util.c
index 68503e8..641b4d9 100644
--- a/shared/util.c
+++ b/shared/util.c
@@ -6,3 +6,11 @@ unsigned long w2_util_exp_mov_avg(unsigned long current_avg, unsigned long new_m
}
int w2_sign(int n) { return (n > 0) - (n < 0); }
+
+unsigned int w2_newline_count(char *str, unsigned int len) {
+ unsigned int newlines = 0;
+ for (unsigned int i = 0; i < len; i++)
+ if (str[i] == '\n') newlines++;
+ return newlines;
+}
+