commit | dac4059a84c4678061d1198fb5d91b368ac518e3 | [log] [tgz] |
---|---|---|
author | Michal Vasko <mvasko@cesnet.cz> | Wed Sep 12 15:31:08 2018 +0200 |
committer | Michal Vasko <mvasko@cesnet.cz> | Wed Sep 12 15:31:08 2018 +0200 |
tree | 2ce64fd59f820dbe1a1f4bf6af58590c83dc47f6 | |
parent | b55f6c1687aeb091790b18eb090cb9518cbd6282 [diff] [blame] |
common NEW function for counting newlines
diff --git a/src/common.c b/src/common.c index 0f55e32..5cd0a90 100644 --- a/src/common.c +++ b/src/common.c
@@ -77,3 +77,17 @@ LOGVAL(ctx, LY_VLOG_NONE, NULL, LY_VCODE_INVAL, date_len, date, stmt); return -1; } + +int +lysp_get_data_line(const char *data, int fail_char) +{ + int i, line = 1; + + for (i = 0; i < fail_char; ++i) { + if (data[i] == '\n') { + ++line; + } + } + + return line; +}