diff --git a/include/import/ist.h b/include/import/ist.h index 3f63ed2dd..6ece7cdf9 100644 --- a/include/import/ist.h +++ b/include/import/ist.h @@ -240,6 +240,21 @@ static inline struct ist istnext(const struct ist ist) return ret; } +/* Returns the first character of the and advances the by 1. + * If the is empty the result is undefined. + */ +static inline char istshift(struct ist *ist) +{ + if (ist->len) { + char c = *ist->ptr; + *ist = istnext(*ist); + + return c; + } + + return 0; +} + /* copies the contents from string to buffer and adds a trailing * zero. The caller must ensure is large enough. */