aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-01-27 17:08:02 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-01-27 17:08:02 +0100
commit2745b489406ffe1e326c45b3ac2134457efd4d80 (patch)
tree1c0f18c1d6c1d98a2107ebc2965ea22c3a366480
parenta15f05f1b43d8e85d9a3f72a0a804dcbeca5068c (diff)
bitvec: Fix build on older gcc
bitvec.c: In function 'bitvec_unhex': bitvec.c:389: error: 'for' loop initial declarations are only allowed in C99 mode bitvec.c:389: note: use option -std=c99 or -std=gnu99 to compile your code
-rw-r--r--src/bitvec.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/bitvec.c b/src/bitvec.c
index f9341b70..2db62efa 100644
--- a/src/bitvec.c
+++ b/src/bitvec.c
@@ -383,10 +383,12 @@ unsigned int bitvec_unpack(struct bitvec *bv, const uint8_t *buffer)
int bitvec_unhex(struct bitvec *bv, const char *src)
{
+ unsigned i;
unsigned val;
unsigned write_index = 0;
unsigned digits = bv->data_len * 2;
- for (unsigned i = 0; i < digits; i++) {
+
+ for (i = 0; i < digits; i++) {
if (sscanf(src + i, "%1x", &val) < 1) {
return 1;
}