Commit dae11387 authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Replace struct with only one member with member.

parent 3010d627
......@@ -37,7 +37,7 @@ cdiPioClientStreamOpen(const char *filename, const char *filemode,
xassert(filename_len > 0 && filename_len < MAXDATAFILENAME);
header = (struct winHeaderEntry){
.id = STREAMOPEN,
.specific.funcCall.funcArgs.newFile
.specific.funcArgs.newFile
= { .fnamelen = (int)filename_len,
.filetype = filetype } };
pioBufferFuncCall(header, filename, filename_len + 1);
......@@ -70,7 +70,7 @@ cdiPioClientStreamDefVlist_(int streamID, int vlistID)
case STAGE_TIMELOOP:
header = (struct winHeaderEntry){
.id = STREAMDEFVLIST,
.specific.funcCall.funcArgs.streamChange = { streamID, vlistID } };
.specific.funcArgs.streamChange = { streamID, vlistID } };
pioBufferFuncCall(header, NULL, 0);
xdebug("WROTE FUNCTION CALL IN BUFFER OF WINS: %s, streamID=%d,"
" vlistID=%d", funcMap[(-1 - STREAMDEFVLIST)], streamID, vlistID);
......@@ -160,7 +160,7 @@ cdiPioClientStreamClose(stream_t *streamptr, int recordBufIsToBeDeleted)
case STAGE_TIMELOOP:
header = (struct winHeaderEntry){
.id = STREAMCLOSE,
.specific.funcCall.funcArgs.streamChange
.specific.funcArgs.streamChange
= { streamptr->self, CDI_UNDEFID } };
pioBufferFuncCall(header, NULL, 0);
xdebug("WROTE FUNCTION CALL IN BUFFER OF WINS: %s, streamID=%d",
......@@ -190,7 +190,7 @@ cdiPioClientStreamDefTimestep_(stream_t *streamptr, int tsID)
taxisID = vlistInqTaxis(streamptr->vlistID);
header = (struct winHeaderEntry){
.id = STREAMDEFTIMESTEP,
.specific.funcCall.funcArgs.streamNewTimestep = { streamptr->self, tsID } };
.specific.funcArgs.streamNewTimestep = { streamptr->self, tsID } };
commCalc = commInqCommCalc();
buf_size = reshResourceGetPackSize(taxisID, &taxisOps, &commCalc);
buf = xmalloc((size_t)buf_size);
......
......@@ -45,23 +45,20 @@ struct dataRecord
int varID, nmiss;
};
struct funcCallDesc
union funcArgs
{
union funcArgs
struct
{
struct
{
int streamID, vlistID;
} streamChange;
struct
{
int streamID, tsID;
} streamNewTimestep;
struct
{
int fnamelen, filetype;
} newFile;
} funcArgs;
int streamID, vlistID;
} streamChange;
struct
{
int streamID, tsID;
} streamNewTimestep;
struct
{
int fnamelen, filetype;
} newFile;
};
/* Describes offset and ID of serialized partition descriptor.
......@@ -78,7 +75,7 @@ struct winHeaderEntry
{
struct headerSize headerSize;
struct dataRecord dataRecord;
struct funcCallDesc funcCall;
union funcArgs funcArgs;
struct partDescRecord partDesc;
} specific;
int offset;
......
......@@ -187,7 +187,7 @@ readFuncCall(struct winHeaderEntry *header)
{
int root = commInqRootGlob ();
int funcID = header->id;
union funcArgs *funcArgs = &(header->specific.funcCall.funcArgs);
union funcArgs *funcArgs = &(header->specific.funcArgs);
xassert(funcID >= MINFUNCID && funcID <= MAXFUNCID);
switch ( funcID )
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment