From ebfc5615fc69b2815949d1f8e6dc5c35557f60c5 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Sat, 19 Aug 2017 21:10:26 +0200 Subject: [PATCH] Simplify loop of _in_str --- m-bitset.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/m-bitset.h b/m-bitset.h index 628cb1da..d5ddc376 100644 --- a/m-bitset.h +++ b/m-bitset.h @@ -513,12 +513,12 @@ bitset_in_str(bitset_t set, FILE *file) int c = fgetc(file); if (c != '[') return false; c = fgetc(file); - do { + while (c == '0' || c == '1') { if (c != '0' && c != '1') break; const bool b = (c == '1'); bitset_push_back (set, b); c = fgetc(file); - } while (c != ']' && c != EOF); + } BITSETI_CONTRACT (set); return c == ']'; }