Skip to content

Commit

Permalink
Fixed -Wcalloc-transposed-args warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbens committed May 10, 2024
1 parent 64cde42 commit d78a9bf
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/gltf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,7 @@ GltfObject *gltf_loadFromFile( const char *filename )
opts.file.read = gltf_read;

/* Initialize object. */
obj = calloc( sizeof( GltfObject ), 1 );
obj = calloc( 1, sizeof( GltfObject ) );

/* Start loading the file. */
res = cgltf_parse_file( &opts, filename, &data );
Expand Down
2 changes: 1 addition & 1 deletion src/map.c
Original file line number Diff line number Diff line change
Expand Up @@ -2411,7 +2411,7 @@ static void map_buttonCommodity( unsigned int wid, const char *str )
window_destroyWidget( wid, "lstMapMode" );
} else { /* show the list widget */
int defpos;
this_map_modes = calloc( sizeof( char * ), array_size( map_modes ) );
this_map_modes = calloc( array_size( map_modes ), sizeof( char * ) );
for ( int i = 0; i < array_size( map_modes ); i++ ) {
this_map_modes[i] = strdup( map_modes[i] );
}
Expand Down
2 changes: 1 addition & 1 deletion src/opengl_tex.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ static GLuint gl_loadSurface( SDL_Surface *surface, unsigned int flags,
static glTexture *gl_texCreate( const char *path, int sx, int sy,
unsigned int flags )
{
glTexture *tex = calloc( sizeof( glTexture ), 1 );
glTexture *tex = calloc( 1, sizeof( glTexture ) );
tex->name = strdup( path );
tex->sx = (double)sx;
tex->sy = (double)sy;
Expand Down
2 changes: 1 addition & 1 deletion src/perlin.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ perlin_data_t *noise_new( void )
unsigned char tmp;

/* Create the data. */
pdata = calloc( sizeof( perlin_data_t ), 1 );
pdata = calloc( 1, sizeof( perlin_data_t ) );

/* Create the buffer and map. */
for ( i = 0; i < 256; i++ )
Expand Down
4 changes: 2 additions & 2 deletions src/shiplog.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ int shiplog_appendByID( int logid, const char *msg )
}
e = e->next;
}
if ( ( e = calloc( sizeof( ShipLogEntry ), 1 ) ) == NULL ) {
if ( ( e = calloc( 1, sizeof( ShipLogEntry ) ) ) == NULL ) {
WARN( _( "Error creating new log entry - crash imminent!\n" ) );
return -1;
}
Expand Down Expand Up @@ -479,7 +479,7 @@ int shiplog_load( xmlNodePtr parent )
strdup( xml_raw( cur ) );
}
} else if ( xml_isNode( cur, "log" ) ) {
e = calloc( sizeof( ShipLogEntry ), 1 );
e = calloc( 1, sizeof( ShipLogEntry ) );
/* put this one at the end */
e->prev = shipLog.tail;
if ( shipLog.tail == NULL )
Expand Down
2 changes: 1 addition & 1 deletion src/tech.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ tech_group_t *tech_groupCreateXML( xmlNodePtr node )
*/
tech_group_t *tech_groupCreate( void )
{
tech_group_t *tech = calloc( sizeof( tech_group_t ), 1 );
tech_group_t *tech = calloc( 1, sizeof( tech_group_t ) );
return tech;
}

Expand Down

0 comments on commit d78a9bf

Please sign in to comment.