]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
sbuff: Add is allowed function
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sun, 28 Jun 2020 19:16:23 +0000 (14:16 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sun, 28 Jun 2020 19:16:23 +0000 (14:16 -0500)
src/lib/util/sbuff.h

index 128bf46205d592d639e21806cf41cf3fcf922276..01184555226f130f8170ab1ce8124bd2f06908a0 100644 (file)
@@ -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;