Skip to content

Commit 12f0abb

Browse files
authored
Merge pull request #177 from libtom/remove-opt-cast
remove OPT_CAST
2 parents 27417b8 + 28e6177 commit 12f0abb

File tree

7 files changed

+6
-15
lines changed

7 files changed

+6
-15
lines changed

bn_mp_fwrite.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ int mp_fwrite(const mp_int *a, int radix, FILE *stream)
2222
return err;
2323
}
2424

25-
buf = OPT_CAST(char) XMALLOC((size_t)len);
25+
buf = (char*) XMALLOC((size_t)len);
2626
if (buf == NULL) {
2727
return MP_MEM;
2828
}

bn_mp_grow.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ int mp_grow(mp_int *a, int size)
2929
* in case the operation failed we don't want
3030
* to overwrite the dp member of a.
3131
*/
32-
tmp = OPT_CAST(mp_digit) XREALLOC(a->dp, sizeof(mp_digit) * (size_t)size);
32+
tmp = (mp_digit*) XREALLOC(a->dp, sizeof(mp_digit) * (size_t)size);
3333
if (tmp == NULL) {
3434
/* reallocation failed but "a" is still valid [can be freed] */
3535
return MP_MEM;

bn_mp_init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ int mp_init(mp_int *a)
1818
int i;
1919

2020
/* allocate memory required and clear it */
21-
a->dp = OPT_CAST(mp_digit) XMALLOC(sizeof(mp_digit) * (size_t)MP_PREC);
21+
a->dp = (mp_digit*) XMALLOC(sizeof(mp_digit) * (size_t)MP_PREC);
2222
if (a->dp == NULL) {
2323
return MP_MEM;
2424
}

bn_mp_init_size.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ int mp_init_size(mp_int *a, int size)
2121
size += (MP_PREC * 2) - (size % MP_PREC);
2222

2323
/* alloc mem */
24-
a->dp = OPT_CAST(mp_digit) XMALLOC(sizeof(mp_digit) * (size_t)size);
24+
a->dp = (mp_digit*) XMALLOC(sizeof(mp_digit) * (size_t)size);
2525
if (a->dp == NULL) {
2626
return MP_MEM;
2727
}

bn_mp_prime_random_ex.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback
4646
bsize = (size>>3) + ((size&7)?1:0);
4747

4848
/* we need a buffer of bsize bytes */
49-
tmp = OPT_CAST(unsigned char) XMALLOC((size_t)bsize);
49+
tmp = (unsigned char*) XMALLOC((size_t)bsize);
5050
if (tmp == NULL) {
5151
return MP_MEM;
5252
}

bn_mp_shrink.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ int mp_shrink(mp_int *a)
2323
}
2424

2525
if (a->alloc != used) {
26-
if ((tmp = OPT_CAST(mp_digit) XREALLOC(a->dp, sizeof(mp_digit) * (size_t)used)) == NULL) {
26+
if ((tmp = (mp_digit*) XREALLOC(a->dp, sizeof(mp_digit) * (size_t)used)) == NULL) {
2727
return MP_MEM;
2828
}
2929
a->dp = tmp;

tommath_private.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,6 @@
2424

2525
#ifdef __cplusplus
2626
extern "C" {
27-
28-
/* C++ compilers don't like assigning void * to mp_digit * */
29-
#define OPT_CAST(x) (x *)
30-
31-
#else
32-
33-
/* C on the other hand doesn't care */
34-
#define OPT_CAST(x)
35-
3627
#endif
3728

3829
/* define heap macros */

0 commit comments

Comments
 (0)