From: Arran Cudbard-Bell Date: Sun, 28 Jun 2020 19:16:23 +0000 (-0500) Subject: sbuff: Add is allowed function X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=606e4d99fbc33af4651adbcdefb044bbaf000f0a;p=thirdparty%2Ffreeradius-server.git sbuff: Add is allowed function --- diff --git a/src/lib/util/sbuff.h b/src/lib/util/sbuff.h index 128bf46205d..01184555226 100644 --- a/src/lib/util/sbuff.h +++ b/src/lib/util/sbuff.h @@ -378,6 +378,12 @@ static inline bool fr_sbuff_next_unless_char(fr_sbuff_t *sbuff, char c) return true; } +static inline bool fr_sbuff_is_allowed(fr_sbuff_t *sbuff, bool const allowed_chars[static UINT8_MAX + 1]) +{ + if (sbuff->p >= sbuff->end) return false; + return allowed_chars[(uint8_t)*sbuff->p]; +} + static inline bool fr_sbuff_is_digit(fr_sbuff_t *sbuff) { if (sbuff->p >= sbuff->end) return false;