Skip to content

Commit

Permalink
Replaced ancient K&R function declarations to be C23 compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
seanm committed Dec 13, 2023
1 parent 002e286 commit f66ca06
Show file tree
Hide file tree
Showing 19 changed files with 81 additions and 160 deletions.
5 changes: 1 addition & 4 deletions libdispatch/dcrc32.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,7 @@ local const z_crc_t FAR * ZEXPORT get_crc_table()
#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1

/* ========================================================================= */
local unsigned long ZEXPORT crc32_z(crc, buf, len)
unsigned long crc;
const unsigned char FAR *buf;
z_size_t len;
local unsigned long ZEXPORT crc32_z(unsigned long crc, const unsigned char FAR *buf, z_size_t len)
{
if (buf == Z_NULL) return 0UL;

Expand Down
3 changes: 1 addition & 2 deletions nc_perf/tst_ar4_4d.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ netcdf thetao_O1.SRESA1B_2.CCSM.ocnm.2000-01_cat_2099-12 {
RESULT. Return 1 if the difference is negative, otherwise 0. This
function from the GNU documentation. */
static int
timeval_subtract (result, x, y)
struct timeval *result, *x, *y;
timeval_subtract (struct timeval *result, struct timeval *x, struct timeval *y)
{
/* Perform the carry for the later subtraction by updating Y. */
if (x->tv_usec < y->tv_usec) {
Expand Down
3 changes: 1 addition & 2 deletions nc_perf/tst_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ See \ref copyright file for more info.
RESULT. Return 1 if the difference is negative, otherwise 0. This
function from the GNU documentation. */
int
nc4_timeval_subtract (result, x, y)
struct timeval *result, *x, *y;
nc4_timeval_subtract (struct timeval *result, struct timeval *x, struct timeval *y)
{
/* Perform the carry for the later subtraction by updating Y. */
if (x->tv_usec < y->tv_usec) {
Expand Down
31 changes: 7 additions & 24 deletions nctest/add.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ struct netcdf test; /*
*/

void
add_dim (test, idim) /* add the dimension idim to the netcdf test */
struct netcdf *test;
struct cdfdim *idim;
add_dim (struct netcdf *test, struct cdfdim *idim) /* add the dimension idim to the netcdf test */
{
static char pname[] = "add_dim";

Expand All @@ -43,9 +41,7 @@ add_dim (test, idim) /* add the dimension idim to the netcdf test */
}

void
add_var (test, ivar) /* add the variable ivar to the netcdf test */
struct netcdf *test;
struct cdfvar *ivar;
add_var (struct netcdf *test, struct cdfvar *ivar) /* add the variable ivar to the netcdf test */
{
static char pname[] = "add_var";
int i;
Expand All @@ -68,10 +64,7 @@ add_var (test, ivar) /* add the variable ivar to the netcdf test */
}

void
add_att (test, varid, iatt) /* add attribute iatt to the netcdf test */
struct netcdf *test;
int varid; /* variable id */
struct cdfatt *iatt;
add_att (struct netcdf *test, int varid, struct cdfatt *iatt) /* add attribute iatt to the netcdf test */
{
static char pname[] = "add_att";
int ia; /* attribute number */
Expand Down Expand Up @@ -108,8 +101,7 @@ add_att (test, varid, iatt) /* add attribute iatt to the netcdf test */


void
add_reset(test) /* reset in-memory netcdf test to empty */
struct netcdf *test;
add_reset(struct netcdf *test) /* reset in-memory netcdf test to empty */
{
test->ndims = 0;
test->nvars = 0;
Expand All @@ -120,10 +112,7 @@ add_reset(test) /* reset in-memory netcdf test to empty */


void
del_att (test, varid, iatt) /* delete attribute iatt in the netcdf test */
struct netcdf *test;
int varid; /* variable id */
struct cdfatt *iatt;
del_att (struct netcdf *test, int varid, struct cdfatt *iatt) /* delete attribute iatt in the netcdf test */
{
static char pname[] = "del_att";
int ia, ib; /* attribute number */
Expand Down Expand Up @@ -153,11 +142,7 @@ del_att (test, varid, iatt) /* delete attribute iatt in the netcdf test */
}

void
add_data(test, varid, start, edges) /* keep max record written updated */
struct netcdf *test;
int varid;
long start[];
long edges[];
add_data(struct netcdf *test, int varid, long start[], long edges[]) /* keep max record written updated */
{
if (varid != test->xdimid) /* not a record variable */
return;
Expand All @@ -167,9 +152,7 @@ add_data(test, varid, start, edges) /* keep max record written updated */


void
errvar(cdfp, varp)
struct netcdf *cdfp;
struct cdfvar *varp;
errvar(struct netcdf *cdfp, struct cdfvar *varp)
{
const char *types;
int id;
Expand Down
22 changes: 7 additions & 15 deletions nctest/atttests.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@
* try with bad netCDF handle, check error
*/
int
test_ncattput(path)
const char *path; /* name of writable netcdf file to open */
test_ncattput(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncattput";
Expand Down Expand Up @@ -341,8 +340,7 @@ test_ncattput(path)
* try with bad netCDF handle, check error
*/
int
test_ncattinq(path)
const char *path; /* name of writable netcdf file to open */
test_ncattinq(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncattinq";
Expand Down Expand Up @@ -456,8 +454,7 @@ test_ncattinq(path)
* try with bad netCDF handle, check error
*/
int
test_ncattget(path)
const char *path; /* name of writable netcdf file to open */
test_ncattget(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
int cdfid; /* netcdf id */
Expand Down Expand Up @@ -628,9 +625,7 @@ test_ncattget(path)
* try with bad source or target variable handle, check error
*/
int
test_ncattcopy(path1, path2)
const char *path1; /* name of input netcdf file to open */
const char *path2; /* name of output netcdf file to create */
test_ncattcopy(const char *path1, const char *path2)
{
int nerrs = 0;
static char pname[] = "test_ncattcopy";
Expand Down Expand Up @@ -905,8 +900,7 @@ test_ncattcopy(path1, path2)
* try with bad attribute number, check error
*/
int
test_ncattname(path)
const char *path; /* name of writable netcdf file to open */
test_ncattname(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncattname";
Expand Down Expand Up @@ -1091,8 +1085,7 @@ test_ncattname(path)
* try with bad netCDF handle, check error
*/
int
test_ncattrename(path)
const char *path; /* name of writable netcdf file to open */
test_ncattrename(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncattrename";
Expand Down Expand Up @@ -1234,8 +1227,7 @@ test_ncattrename(path)
* try in data mode, check error
*/
int
test_ncattdel(path)
const char *path; /* name of writable netcdf file to open */
test_ncattdel(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncattdel";
Expand Down
24 changes: 8 additions & 16 deletions nctest/cdftests.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
* Uses: nccreate, ncendef, ncclose, ncopen.
*/
int
test_nccreate(path)
const char *path; /* name of netCDF file to create */
test_nccreate(const char *path) /* name of netCDF file to create */
{
int nerrs = 0;
static char pname[] = "test_nccreate";
Expand Down Expand Up @@ -94,8 +93,7 @@ test_nccreate(path)
#define DATA_LEN 32
#define TEMP_FILE_NAME "temp.tmp"
int
test_ncopen(path)
const char *path; /* name of writable netcdf file to open */
test_ncopen(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncopen";
Expand Down Expand Up @@ -240,8 +238,7 @@ test_ncopen(path)
* Uses: ncopen, ncredef, ncdimdef, ncvardef, ncattput, ncclose
*/
int
test_ncredef(path)
const char *path; /* name of writable netcdf file to open */
test_ncredef(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncredef";
Expand Down Expand Up @@ -328,8 +325,7 @@ test_ncredef(path)
* Uses: ncopen, ncredef, ncdimdef, ncvardef, ncattput, ncendef, ncclose
*/
int
test_ncendef(path)
const char *path; /* name of writable netcdf file to open */
test_ncendef(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncendef";
Expand Down Expand Up @@ -422,8 +418,7 @@ test_ncendef(path)
* On exit netcdf files are closed.
*/
int
test_ncclose(path)
const char *path; /* name of writable netcdf file to open */
test_ncclose(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncclose";
Expand Down Expand Up @@ -476,8 +471,7 @@ test_ncclose(path)
* On exit netcdf files are closed.
*/
int
test_ncinquire(path)
const char *path; /* name of writable netcdf file to open */
test_ncinquire(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncinquire";
Expand Down Expand Up @@ -640,8 +634,7 @@ test_ncinquire(path)
* On exit netcdf files are closed.
*/
int
test_ncsync(path)
const char *path; /* name of writable netcdf file to open */
test_ncsync(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncsync";
Expand Down Expand Up @@ -781,8 +774,7 @@ test_ncsync(path)
* On exit netcdf files are closed.
*/
int
test_ncabort(path)
const char *path; /* name of writable netcdf file to open */
test_ncabort(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncabort";
Expand Down
12 changes: 4 additions & 8 deletions nctest/dimtests.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
* try to define a second unlimited dimension, check error
*/
int
test_ncdimdef(path)
const char *path; /* name of writable netcdf to open */
test_ncdimdef(const char *path) /* name of writable netcdf to open */
{
int nerrs = 0;
static char pname[] = "test_ncdimdef";
Expand Down Expand Up @@ -129,8 +128,7 @@ test_ncdimdef(path)
* try with bad handle, check error
*/
int
test_ncdimid(path)
const char *path; /* name of writable netcdf file to open */
test_ncdimid(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncdimid";
Expand Down Expand Up @@ -206,8 +204,7 @@ test_ncdimid(path)
* try with bad netCDF handle, check error
*/
int
test_ncdiminq(path)
const char *path; /* name of writable netcdf file to open */
test_ncdiminq(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncdiminq";
Expand Down Expand Up @@ -303,8 +300,7 @@ test_ncdiminq(path)
* try with bad netCDF handle, check error
*/
int
test_ncdimrename(path)
const char *path; /* name of writable netcdf file to open */
test_ncdimrename(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncdimrename";
Expand Down
7 changes: 2 additions & 5 deletions nctest/emalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
#include "emalloc.h"

void *
emalloc (size) /* check return from malloc */
size_t size;
emalloc (size_t size) /* check return from malloc */
{
void *p;

Expand All @@ -32,9 +31,7 @@ emalloc (size) /* check return from malloc */
}

void *
erealloc (ptr, size) /* check return from realloc */
void *ptr;
size_t size;
erealloc (void *ptr, size_t size) /* check return from realloc */
{
void *p;

Expand Down
Loading

0 comments on commit f66ca06

Please sign in to comment.