diff options
Diffstat (limited to 'shared/util.c')
-rw-r--r-- | shared/util.c | 8 |
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; +} + |