diff options
author | Ran Benita <ran234@gmail.com> | 2014-10-07 23:42:08 +0300 |
---|---|---|
committer | Ran Benita <ran234@gmail.com> | 2014-10-08 00:03:34 +0300 |
commit | 8a0acf2c67633a5569124d6928c17c9a885949a5 (patch) | |
tree | eaf32e8d8ab0bfb4edcd9200dcbddc6b6dc4ff0a /src/scanner-utils.h | |
parent | 8d58e250b005644f5fcaf60c9e6692caf707ef42 (diff) | |
download | xorg-lib-libxkbcommon-8a0acf2c67633a5569124d6928c17c9a885949a5.tar.gz |
scanner-utils: optimize one-line comments
Compose files have a lot of those.
Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'src/scanner-utils.h')
-rw-r--r-- | src/scanner-utils.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/scanner-utils.h b/src/scanner-utils.h index ba47f69..914e11f 100644 --- a/src/scanner-utils.h +++ b/src/scanner-utils.h @@ -102,6 +102,15 @@ eol(struct scanner *s) return peek(s) == '\n'; } +static inline void +skip_to_eol(struct scanner *s) +{ + const char *nl = memchr(s->s + s->pos, '\n', s->len - s->pos); + const size_t new_pos = nl ? (size_t) (nl - s->s) : s->len; + s->column += new_pos - s->pos; + s->pos = new_pos; +} + static inline char next(struct scanner *s) { |