}
return (int)ldns_buffer_read_u8(buffer);
}
+
+/* fast forwards the buffer, skipping the given char, setting the
+ * buffer position to the location of the first different char
+ * (or to the end of the buffer)
+ */
+void
+ldns_bskipc(ldns_buffer *buffer, char c)
+{
+ while (c == (char) ldns_buffer_read_u8_at(buffer, ldns_buffer_position(buffer))) {
+ if (ldns_buffer_available_at(buffer, buffer->_position + sizeof(char), sizeof(char))) {
+ buffer->_position += sizeof(char);
+ } else {
+ return;
+ }
+ }
+}
+
+/* fast forwards the buffer, skipping all chars in the given string,
+ * setting the buffer position to the first char that is not contained
+ * in the string (or to the end of the buffer)
+ */
+void
+ldns_bskipcs(ldns_buffer *buffer, char *s)
+{
+ bool found;
+ char c;
+ char *d;
+
+ while(ldns_buffer_available_at(buffer, buffer->_position, sizeof(char))) {
+ c = (char) ldns_buffer_read_u8_at(buffer,
+ buffer->_position);
+ found = false;
+ for (d = s; *d; d++) {
+ if (*d == c) {
+ found = true;
+ }
+ }
+ if (found && buffer->_limit > buffer->_position) {
+ buffer->_position += sizeof(char);
+ } else {
+ return;
+ }
+ }
+}
+
+