Skip to content

Commit 622430e

Browse files
committed
fix alloc type and in-case declaration errors
1 parent 8bfdeea commit 622430e

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/misc/btor/btor2parser.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ btor2parser_strdup (const char *str)
6868
{
6969
assert (str);
7070

71-
char *res = btor2parser_malloc (strlen (str) + 1);
71+
char *res = (char *)btor2parser_malloc (strlen (str) + 1);
7272
strcpy (res, str);
7373
return res;
7474
}
7575

7676
Btor2Parser *
7777
btor2parser_new ()
7878
{
79-
Btor2Parser *res = btor2parser_malloc (sizeof *res);
79+
Btor2Parser *res = (Btor2Parser *)btor2parser_malloc (sizeof *res);
8080
memset (res, 0, sizeof *res);
8181
return res;
8282
}
@@ -158,7 +158,7 @@ perr_bfr (Btor2Parser *bfr, const char *fmt, ...)
158158
va_end (ap);
159159
buf[1023] = '\0';
160160

161-
bfr->error = btor2parser_malloc (strlen (buf) + 28);
161+
bfr->error = (char *)btor2parser_malloc (strlen (buf) + 28);
162162
sprintf (bfr->error, "line %" PRId64 ": %s", bfr->lineno, buf);
163163
return 0;
164164
}
@@ -169,7 +169,7 @@ pushc_bfr (Btor2Parser *bfr, int32_t ch)
169169
if (bfr->nbuf >= bfr->szbuf)
170170
{
171171
bfr->szbuf = bfr->szbuf ? 2 * bfr->szbuf : 1;
172-
bfr->buf = btor2parser_realloc (bfr->buf, bfr->szbuf * sizeof *bfr->buf);
172+
bfr->buf = (char *)btor2parser_realloc (bfr->buf, bfr->szbuf * sizeof *bfr->buf);
173173
}
174174
bfr->buf[bfr->nbuf++] = ch;
175175
}
@@ -181,7 +181,7 @@ pusht_bfr (Btor2Parser *bfr, Btor2Line *l)
181181
{
182182
bfr->sztable = bfr->sztable ? 2 * bfr->sztable : 1;
183183
bfr->table =
184-
btor2parser_realloc (bfr->table, bfr->sztable * sizeof *bfr->table);
184+
(Btor2Line **)btor2parser_realloc (bfr->table, bfr->sztable * sizeof *bfr->table);
185185
}
186186
bfr->table[bfr->ntable++] = l;
187187
}
@@ -401,13 +401,13 @@ new_line_bfr (Btor2Parser *bfr,
401401
Btor2Line *res;
402402
assert (0 < id);
403403
assert (bfr->ntable <= id);
404-
res = btor2parser_malloc (sizeof *res);
404+
res = (Btor2Line *)btor2parser_malloc (sizeof *res);
405405
memset (res, 0, sizeof (*res));
406406
res->id = id;
407407
res->lineno = lineno;
408408
res->tag = tag;
409409
res->name = name;
410-
res->args = btor2parser_malloc (sizeof (int64_t) * 3);
410+
res->args = (int64_t *)btor2parser_malloc (sizeof (int64_t) * 3);
411411
memset (res->args, 0, sizeof (int64_t) * 3);
412412
while (bfr->ntable < id) pusht_bfr (bfr, 0);
413413
assert (bfr->ntable == id);
@@ -617,7 +617,7 @@ check_sorts_bfr (Btor2Parser *bfr, Btor2Line *l)
617617
break;
618618

619619
/* [u:l] -> u - l + 1 */
620-
case BTOR2_TAG_slice:
620+
case BTOR2_TAG_slice: {
621621
assert (l->nargs == 1);
622622
if (!check_sort_bitvec (bfr, l, args)) return 0;
623623
/* NOTE: this cast is safe since l->args[1] and l->args[2] contains
@@ -631,7 +631,7 @@ check_sorts_bfr (Btor2Parser *bfr, Btor2Line *l)
631631
l->name,
632632
upper - lower + 1);
633633
break;
634-
634+
}
635635
/* 1 x 1 -> 1 */
636636
case BTOR2_TAG_iff:
637637
case BTOR2_TAG_implies:
@@ -706,7 +706,7 @@ check_sorts_bfr (Btor2Parser *bfr, Btor2Line *l)
706706
break;
707707

708708
case BTOR2_TAG_sext:
709-
case BTOR2_TAG_uext:
709+
case BTOR2_TAG_uext: {
710710
assert (l->nargs == 1);
711711
if (!check_sort_bitvec (bfr, l, args)) return 0;
712712
/* NOTE: this cast is safe since l->args[1] contains the extension
@@ -719,7 +719,7 @@ check_sorts_bfr (Btor2Parser *bfr, Btor2Line *l)
719719
l->name,
720720
ext);
721721
break;
722-
722+
}
723723
case BTOR2_TAG_read:
724724
assert (l->nargs == 2);
725725
if (args[0]->sort.tag != BTOR2_TAG_SORT_array)
@@ -1000,7 +1000,7 @@ mult_unbounded_bin_str (const char *a, const char *b)
10001000
alen = strlen (a);
10011001
blen = strlen (b);
10021002
rlen = alen + blen;
1003-
res = btor2parser_malloc (rlen + 1);
1003+
res = (char *)btor2parser_malloc (rlen + 1);
10041004
res[rlen] = 0;
10051005

10061006
for (r = res; r < res + blen; r++) *r = '0';
@@ -1058,7 +1058,7 @@ add_unbounded_bin_str (const char *a, const char *b)
10581058
rlen = (alen < blen) ? blen : alen;
10591059
rlen++;
10601060

1061-
res = btor2parser_malloc (rlen + 1);
1061+
res = (char *)btor2parser_malloc (rlen + 1);
10621062

10631063
p = a + alen;
10641064
q = b + blen;
@@ -1256,7 +1256,7 @@ check_state_init (Btor2Parser *bfr, int64_t state_id, int64_t init_id)
12561256

12571257
// 'init_id' is the highest id we will see when traversing down
12581258
size_t size = (labs (init_id) + 1) * sizeof (char);
1259-
cache = btor2parser_malloc (size);
1259+
cache = (char *)btor2parser_malloc (size);
12601260
memset (cache, 0, size);
12611261

12621262
BTOR2_INIT_STACK (stack);
@@ -1342,7 +1342,7 @@ parse_justice_bfr (Btor2Parser *bfr, Btor2Line *l)
13421342
{
13431343
uint32_t nargs;
13441344
if (!parse_pos_number_bfr (bfr, &nargs)) return 0;
1345-
l->args = btor2parser_realloc (l->args, sizeof (int64_t) * nargs);
1345+
l->args = (int64_t *)btor2parser_realloc (l->args, sizeof (int64_t) * nargs);
13461346
l->nargs = nargs;
13471347
if (!parse_args (bfr, l, nargs)) return 0;
13481348
return 1;

0 commit comments

Comments
 (0)