Skip to content

Commit 8bfdeea

Browse files
committed
get rid of typeof
1 parent 998a32a commit 8bfdeea

File tree

3 files changed

+9
-22
lines changed

3 files changed

+9
-22
lines changed

src/misc/btor/btor2mem.h

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,8 @@ ABC_NAMESPACE_HEADER_START
2525

2626
/*------------------------------------------------------------------------*/
2727

28-
#define BTOR2_NEWN(ptr, nelems) \
29-
((ptr) = (typeof(ptr)) btorsim_malloc ((nelems) * sizeof *(ptr)))
30-
31-
#define BTOR2_CNEWN(ptr, nelems) \
32-
((ptr) = (typeof(ptr)) btorsim_calloc ((nelems), sizeof *(ptr)))
33-
3428
#define BTOR2_CLRN(ptr, nelems) (memset ((ptr), 0, (nelems) * sizeof *(ptr)))
3529

36-
#define BTOR2_REALLOC(p, n) \
37-
((p) = (typeof(p)) btorsim_realloc ((p), ((n) * sizeof *(p))))
38-
39-
#define BTOR2_NEW(ptr) BTOR2_NEWN ((ptr), 1)
40-
41-
#define BTOR2_CNEW(ptr) BTOR2_CNEWN ((ptr), 1)
42-
4330
#define BTOR2_CLR(ptr) BTOR2_CLRN ((ptr), 1)
4431

4532
#define BTOR2_DELETE(ptr) (free (ptr))
@@ -90,7 +77,7 @@ btorsim_strdup (const char *str)
9077
char *res = 0;
9178
if (str)
9279
{
93-
BTOR2_NEWN (res, strlen (str) + 1);
80+
res = (char *) btorsim_malloc ((strlen (str) + 1) * sizeof (char));
9481
strcpy (res, str);
9582
}
9683
return res;

src/misc/btor/btor2parser.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,7 +1260,7 @@ check_state_init (Btor2Parser *bfr, int64_t state_id, int64_t init_id)
12601260
memset (cache, 0, size);
12611261

12621262
BTOR2_INIT_STACK (stack);
1263-
BTOR2_PUSH_STACK (stack, init_id);
1263+
BTOR2_PUSH_STACK (int64_t, stack, init_id);
12641264
do
12651265
{
12661266
id = BTOR2_POP_STACK (stack);
@@ -1282,7 +1282,7 @@ check_state_init (Btor2Parser *bfr, int64_t state_id, int64_t init_id)
12821282
id);
12831283
break;
12841284
}
1285-
for (i = 0; i < line->nargs; i++) BTOR2_PUSH_STACK (stack, line->args[i]);
1285+
for (i = 0; i < line->nargs; i++) BTOR2_PUSH_STACK (int64_t, stack, line->args[i]);
12861286
} while (!BTOR2_EMPTY_STACK (stack));
12871287

12881288
free (cache);

src/misc/btor/btor2stack.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,28 +53,28 @@ BTOR2_DECLARE_STACK (BtorVoidPtr, void *);
5353
BTOR2_INIT_STACK ((stack)); \
5454
} while (0)
5555

56-
#define BTOR2_ENLARGE(p, o, n) \
56+
#define BTOR2_ENLARGE(T, p, o, n) \
5757
do \
5858
{ \
5959
size_t internaln = (o) ? 2 * (o) : 1; \
60-
BTOR2_REALLOC ((p), internaln); \
60+
(p) = (T *) btorsim_realloc ((p), ((internaln) * sizeof (T))); \
6161
(n) = internaln; \
6262
} while (0)
6363

64-
#define BTOR2_ENLARGE_STACK(stack) \
64+
#define BTOR2_ENLARGE_STACK(T, stack) \
6565
do \
6666
{ \
6767
size_t old_size = BTOR2_SIZE_STACK (stack), new_size; \
6868
size_t old_count = BTOR2_COUNT_STACK (stack); \
69-
BTOR2_ENLARGE ((stack).start, old_size, new_size); \
69+
BTOR2_ENLARGE (T, (stack).start, old_size, new_size); \
7070
(stack).top = (stack).start + old_count; \
7171
(stack).end = (stack).start + new_size; \
7272
} while (0)
7373

74-
#define BTOR2_PUSH_STACK(stack, elem) \
74+
#define BTOR2_PUSH_STACK(T, stack, elem) \
7575
do \
7676
{ \
77-
if (BTOR2_FULL_STACK ((stack))) BTOR2_ENLARGE_STACK ((stack)); \
77+
if (BTOR2_FULL_STACK ((stack))) BTOR2_ENLARGE_STACK (T, (stack)); \
7878
*((stack).top++) = (elem); \
7979
} while (0)
8080

0 commit comments

Comments
 (0)