Style fixes to both lexers
diff --git a/src/bc/lex.c b/src/bc/lex.c
index 391e87a..7195ee2 100644
--- a/src/bc/lex.c
+++ b/src/bc/lex.c
@@ -42,9 +42,7 @@
return BC_STATUS_LEX_NO_STRING_END;
}
- len = i - l->idx;
- if (len > (unsigned long) BC_MAX_STRING) return BC_STATUS_EXEC_STRING_LEN;
-
+ if ((len = i - l->idx) > BC_MAX_STRING) return BC_STATUS_EXEC_STRING_LEN;
if ((s = bc_vec_string(&l->t.v, len, l->buffer + l->idx))) return s;
l->idx = i + 1;
diff --git a/src/dc/lex.c b/src/dc/lex.c
index ae57ec7..f2083e6 100644
--- a/src/dc/lex.c
+++ b/src/dc/lex.c
@@ -29,7 +29,7 @@
BcStatus dc_lex_string(BcLex *l) {
BcStatus s;
- size_t len, depth = 1, nls = 0, idx, i = l->idx;
+ size_t depth = 1, nls = 0, idx, i = l->idx;
char c;
l->t.t = BC_LEX_STRING;
@@ -66,10 +66,8 @@
return BC_STATUS_LEX_NO_STRING_END;
}
- len = i - idx;
- if (len > (unsigned long) BC_MAX_STRING) return BC_STATUS_EXEC_STRING_LEN;
-
if ((s = bc_vec_pushByte(&l->t.v, '\0'))) return s;
+ if (i - idx > BC_MAX_STRING) return BC_STATUS_EXEC_STRING_LEN;
l->idx = i + 1;
l->line += nls;