From ae62cf903d5679f140a3de9aab88a684fc618870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ne=C4=8Dada?= Date: Thu, 23 Jul 2020 14:18:07 +0300 Subject: [PATCH] C99 standard compliance for static const initialisers. --- qpms/scatsystem.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/qpms/scatsystem.c b/qpms/scatsystem.c index 3fd27fb..8d56866 100644 --- a/qpms/scatsystem.c +++ b/qpms/scatsystem.c @@ -2044,15 +2044,14 @@ ccart3_t qpms_scatsysw_scattered_E(const qpms_scatsys_at_omega_t *ssw, } -static const int DIPSPECN = 3; +#define DIPSPECN 3 // We have three basis vectors // Evaluates the regular electric dipole waves in the origin. The returned // value is not to be freed as in the usual case. static inline const qpms_vswf_set_spec_t qpms_fill_regdipoles_0( ccart3_t regdipoles_0[DIPSPECN], qpms_normalisation_t normalisation) { - static const int dipspecn = DIPSPECN; // We have three basis vectors // bspec containing only electric dipoles const qpms_vswf_set_spec_t dipspec = { - .n = dipspecn, + .n = DIPSPECN, .ilist = (qpms_uvswfi_t[]){ qpms_tmn2uvswfi(QPMS_VSWF_ELECTRIC, -1, 1), qpms_tmn2uvswfi(QPMS_VSWF_ELECTRIC, 0, 1), @@ -2064,17 +2063,16 @@ static inline const qpms_vswf_set_spec_t qpms_fill_regdipoles_0( }; const sph_t origin_sph = {.r = 0, .theta = M_PI_2, .phi=0}; // Should work with any theta/phi (TESTWORTHY) - csphvec_t regdipoles_0_sph[dipspecn]; + csphvec_t regdipoles_0_sph[DIPSPECN]; QPMS_ENSURE_SUCCESS(qpms_uvswf_fill(regdipoles_0_sph, &dipspec, sph2csph(origin_sph), QPMS_BESSEL_REGULAR)); - for(int i = 0; i < dipspecn; ++i) + for(int i = 0; i < DIPSPECN; ++i) regdipoles_0[i] = csphvec2ccart(regdipoles_0_sph[i], origin_sph); return dipspec; } - // Alternative implementation, using translation operator and regular dipole waves at zero ccart3_t qpms_scatsys_scattered_E__alt(const qpms_scatsys_t *ss, qpms_bessel_t btyp,