Skip to content

Commit 8caf06a

Browse files
Merge pull request #710 from ourairquality/convrnx-calloc-arg-order
convrnx: correct calloc() argument order
2 parents 4ae598d + 8378373 commit 8caf06a

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/convrnx.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ static strfile_t *gen_strfile(int format, const char *opt)
166166

167167
trace(3,"init_strfile:\n");
168168

169-
if (!(str=(strfile_t *)calloc(sizeof(strfile_t),1))) return NULL;
169+
if (!(str=(strfile_t *)calloc(1, sizeof(strfile_t)))) return NULL;
170170

171171
str->format=format;
172172
str->staid=-1;
@@ -605,7 +605,7 @@ static void update_stas(strfile_t *str)
605605
stas_t *p;
606606

607607
if (!str->stas||str->stas->staid!=str->staid) { /* station ID changed */
608-
if (!(p=(stas_t *)calloc(sizeof(stas_t),1))) return;
608+
if (!(p=(stas_t *)calloc(1, sizeof(stas_t)))) return;
609609
p->staid=str->staid;
610610
p->ts=p->te=str->time;
611611
p->next=str->stas;
@@ -651,7 +651,7 @@ static int add_halfc(strfile_t *str, int sat, int idx, gtime_t time)
651651
{
652652
halfc_t *p;
653653

654-
if (!(p=(halfc_t *)calloc(sizeof(halfc_t),1))) return 0;
654+
if (!(p=(halfc_t *)calloc(1, sizeof(halfc_t)))) return 0;
655655
p->ts=p->te=time;
656656
p->stat=0;
657657
p->next=str->halfc[sat-1][idx];

0 commit comments

Comments
 (0)