From 38e7030f127f567fd2d02f27663168dde4472d57 Mon Sep 17 00:00:00 2001
From: Timotej Kapus <tk1713@ic.ac.uk>
Date: Wed, 24 Oct 2018 23:47:22 +0100
Subject: [PATCH] maint: change 3 loops to strspn calls
* src/ifdef.c: Change 3 loops to equivalent calls to strspn
---
src/ifdef.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/src/ifdef.c b/src/ifdef.c
index 0ecc2c0..8046ac5 100644
--- a/src/ifdef.c
+++ b/src/ifdef.c
@@ -313,13 +313,10 @@ do_printf_spec (FILE *out, char const *spec,
/* Scan printf-style SPEC of the form %[-'0]*[0-9]*(.[0-9]*)?[cdoxX]. */
/* assert (*f == '%'); */
f++;
- while ((c = *f++) == '-' || c == '\'' || c == '0')
- continue;
- while (ISDIGIT (c))
- c = *f++;
- if (c == '.')
- while (ISDIGIT (c = *f++))
- continue;
+ f += strspn(f, "-\'0") + 1;
+ f += strspn(f, "0123456789") + 1;
+ if ((c = *f++) == '.')
+ f += strspn(f, "0123456789") + 1;
c1 = *f++;
switch (c)
--
2.7.4