Skip to content

Commit 2e5bd15

Browse files
authored
Silence some warnings (#2429)
1 parent ac0a833 commit 2e5bd15

File tree

14 files changed

+16
-23
lines changed

14 files changed

+16
-23
lines changed

src/acb_theta/ql_exact.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -400,10 +400,7 @@ acb_theta_ql_perform_steps(acb_ptr th, acb_ptr th_init, acb_srcptr rts,
400400
th_next = _acb_vec_init(3 * n * nb);
401401
d = _arb_vec_init(n);
402402
d0 = _arb_vec_init(n);
403-
if (all)
404-
{
405-
aux = _acb_vec_init(n * n);
406-
}
403+
aux = (all) ? _acb_vec_init(n * n) : NULL;
407404

408405
for (k = nb_steps - 1; k >= 0; k--)
409406
{
@@ -519,10 +516,7 @@ acb_theta_ql_exact_steps(acb_ptr th, acb_srcptr zs, slong nb,
519516
th_init = _acb_vec_init(3 * n * nb);
520517
easy_steps = flint_malloc(nb * sizeof(slong));
521518
acb_mat_init(new_tau, g, g);
522-
if (all)
523-
{
524-
rts_all = _acb_vec_init(nb * n * n);
525-
}
519+
rts_all = (all) ? _acb_vec_init(nb * n * n) : NULL;
526520

527521
res = acb_theta_ql_setup(rts, rts_all, t, &guard, easy_steps, zs, nb, tau, distances,
528522
nb_steps, all, prec);

src/fmpq_mpoly/get_coeff_fmpq_fmpz.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void fmpq_mpoly_get_coeff_fmpq_fmpz(fmpq_t c, const fmpq_mpoly_t poly,
6363
TMP_INIT;
6464

6565
TMP_START;
66-
newexp = (fmpz *) TMP_ALLOC(nvars*sizeof(fmpz));
66+
newexp = (nvars > 0) ? TMP_ALLOC(nvars*sizeof(fmpz)) : NULL;
6767
for (i = 0; i < nvars; i++)
6868
{
6969
fmpz_init(newexp + i);

src/fmpq_mpoly/get_coeff_fmpq_ui.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ void fmpq_mpoly_get_coeff_fmpq_ui(fmpq_t c, const fmpq_mpoly_t poly,
1919
TMP_INIT;
2020

2121
TMP_START;
22-
newexp = (fmpz *) TMP_ALLOC(nvars*sizeof(fmpz));
22+
newexp = (nvars > 0) ? TMP_ALLOC(nvars*sizeof(fmpz)) : NULL;
2323
for (i = 0; i < nvars; i++)
2424
fmpz_init_set_ui(newexp + i, exp[i]);
2525

src/fmpq_mpoly/set_coeff_fmpq_fmpz.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ void fmpq_mpoly_set_coeff_fmpq_fmpz(fmpq_mpoly_t poly,
110110
TMP_INIT;
111111

112112
TMP_START;
113-
newexp = (fmpz *) TMP_ALLOC(nvars*sizeof(fmpz));
113+
newexp = (nvars > 0) ? TMP_ALLOC(nvars*sizeof(fmpz)) : NULL;
114114
for (i = 0; i < nvars; i++)
115115
{
116116
fmpz_init(newexp + i);

src/fmpq_mpoly/set_coeff_fmpq_ui.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ void fmpq_mpoly_set_coeff_fmpq_ui(fmpq_mpoly_t poly,
2020
TMP_INIT;
2121

2222
TMP_START;
23-
newexp = (fmpz *) TMP_ALLOC(nvars*sizeof(fmpz));
23+
newexp = (nvars > 0) ? TMP_ALLOC(nvars*sizeof(fmpz)) : NULL;
2424
for (i = 0; i < nvars; i++)
2525
fmpz_init_set_ui(newexp + i, exp[i]);
2626

src/fmpz_mod_mpoly/set_coeff_fmpz_ui.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ void fmpz_mod_mpoly_set_coeff_fmpz_ui(fmpz_mod_mpoly_t poly,
1919
TMP_INIT;
2020

2121
TMP_START;
22-
newexp = (fmpz *) TMP_ALLOC(nvars*sizeof(fmpz));
22+
newexp = (nvars > 0) ? TMP_ALLOC(nvars*sizeof(fmpz)) : NULL;
2323
for (i = 0; i < nvars; i++)
2424
fmpz_init_set_ui(newexp + i, exp[i]);
2525

src/fmpz_mpoly/set_coeff_fmpz_fmpz.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void fmpz_mpoly_set_coeff_fmpz_fmpz(fmpz_mpoly_t poly,
8484
TMP_INIT;
8585

8686
TMP_START;
87-
newexp = (fmpz *) TMP_ALLOC(nvars*sizeof(fmpz));
87+
newexp = (nvars > 0) ? TMP_ALLOC(nvars*sizeof(fmpz)) : NULL;
8888
for (i = 0; i < nvars; i++)
8989
{
9090
fmpz_init(newexp + i);

src/fmpz_mpoly/set_coeff_fmpz_ui.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ void fmpz_mpoly_set_coeff_fmpz_ui(fmpz_mpoly_t poly,
2020
TMP_INIT;
2121

2222
TMP_START;
23-
newexp = (fmpz *) TMP_ALLOC(nvars*sizeof(fmpz));
23+
newexp = (nvars > 0) ? TMP_ALLOC(nvars*sizeof(fmpz)) : NULL;
2424
for (i = 0; i < nvars; i++)
2525
fmpz_init_set_ui(newexp + i, exp[i]);
2626

src/fq_nmod_mpoly/set_coeff_fq_nmod_fmpz.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ void fq_nmod_mpoly_set_coeff_fq_nmod_fmpz(
9494
TMP_INIT;
9595

9696
TMP_START;
97-
newexp = (fmpz *) TMP_ALLOC(nvars*sizeof(fmpz));
97+
newexp = (nvars > 0) ? TMP_ALLOC(nvars*sizeof(fmpz)) : NULL;
9898
for (i = 0; i < nvars; i++)
9999
{
100100
fmpz_init(newexp + i);

src/fq_nmod_mpoly/set_coeff_fq_nmod_ui.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ void fq_nmod_mpoly_set_coeff_fq_nmod_ui(fq_nmod_mpoly_t poly,
2020
TMP_INIT;
2121

2222
TMP_START;
23-
newexp = (fmpz *) TMP_ALLOC(nvars*sizeof(fmpz));
23+
newexp = (nvars > 0) ? TMP_ALLOC(nvars*sizeof(fmpz)) : NULL;
2424
for (i = 0; i < nvars; i++)
2525
fmpz_init_set_ui(newexp + i, exp[i]);
2626

0 commit comments

Comments
 (0)