Skip to content

Commit

Permalink
Add calloc()/etc casts to suppress -Wc++-compat warnings
Browse files Browse the repository at this point in the history
(These warnings are seen in non-configure builds as -Wc++-compat
is in the Makefile's default CFLAGS.)
  • Loading branch information
jmarshall committed Nov 26, 2019
1 parent 66cba75 commit a346bbb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions cols.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ cols_t *cols_split(const char *line, cols_t *cols, char delim)
if ( cols->n > cols->m )
{
cols->m += 10;
cols->off = realloc(cols->off, sizeof(*cols->off)*cols->m);
cols->off = (char**) realloc(cols->off, sizeof(*cols->off)*cols->m);
}
cols->off[ cols->n - 1 ] = ss;
if ( !tmp ) break;
Expand All @@ -60,8 +60,8 @@ void cols_append(cols_t *cols, char *str)
size_t tot_len = 2 + str_len + lst_len + (cols->off[ cols->n - 1 ] - cols->rmme);

cols_t *tmp_cols = (cols_t*)calloc(1,sizeof(cols_t));
tmp_cols->rmme = calloc(tot_len,1);
tmp_cols->off = calloc(cols->n+1,sizeof(*tmp_cols->off));
tmp_cols->rmme = (char*) calloc(tot_len,1);
tmp_cols->off = (char**) calloc(cols->n+1,sizeof(*tmp_cols->off));

char *ptr = tmp_cols->rmme;
int i;
Expand All @@ -88,7 +88,7 @@ void cols_append(cols_t *cols, char *str)
if ( cols->n > cols->m )
{
cols->m++;
cols->off = realloc(cols->off,sizeof(*cols->off)*cols->m);
cols->off = (char**) realloc(cols->off,sizeof(*cols->off)*cols->m);
}
cols->off[cols->n-1] = str;
}
Expand Down
2 changes: 1 addition & 1 deletion vcfconcat.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ static void init_data(args_t *args)
}
else
{
args->tpool = calloc(1, sizeof(*args->tpool));
args->tpool = (htsThreadPool*) calloc(1, sizeof(htsThreadPool));
if ( !args->tpool ) error("Failed to allocate memory\n");
if ( !(args->tpool->pool = hts_tpool_init(args->n_threads)) ) error("Failed to initialize %d threads\n",args->n_threads);
}
Expand Down

0 comments on commit a346bbb

Please sign in to comment.