Commit 5f88a0e1 authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Remove redundant check.

* stream_to_pointer never returns NULL.
parent 8e94f5eb
......@@ -187,9 +187,6 @@ The valid CDI file format types are @func{FILETYPE_GRB}, @func{FILETYPE_GRB2}, @
int streamInqFiletype(int streamID)
{
stream_t *streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
return (streamptr->filetype);
}
......@@ -233,9 +230,6 @@ with the file format type @func{FILETYPE_SRV}, @func{FILETYPE_EXT} or @func{FILE
void streamDefByteorder(int streamID, int byteorder)
{
stream_t *streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
streamptr->byteorder = byteorder;
int filetype = streamptr->filetype;
......@@ -293,9 +287,6 @@ The valid CDI byte order types are @func{CDI_BIGENDIAN} and @func{CDI_LITTLEENDI
int streamInqByteorder(int streamID)
{
stream_t *streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
return (streamptr->byteorder);
}
......@@ -319,9 +310,6 @@ const char *streamFilesuffix(int filetype)
const char *streamFilename(int streamID)
{
stream_t *streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
return (streamptr->filename);
}
......@@ -330,9 +318,6 @@ long cdiInqTimeSize(int streamID)
{
int tsID = 0, nrecs;
stream_t *streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
long ntsteps = streamptr->ntsteps;
if ( ntsteps == (long)CDI_UNDEFID )
......@@ -979,8 +964,6 @@ void streamClose(int streamID)
int index;
stream_t *streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
if ( CDI_Debug )
Message("streamID = %d filename = %s", streamID, streamptr->filename);
......@@ -1117,8 +1100,6 @@ void streamSync(int streamID)
{
stream_t *streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
void (*myStreamSync_)(stream_t *streamptr)
= (void (*)(stream_t *))namespaceSwitchGet(NSSWITCH_STREAM_SYNC).func;
myStreamSync_(streamptr);
......@@ -1129,11 +1110,11 @@ int cdiStreamDefTimestep_(stream_t *streamptr, int tsID)
{
int taxisID = 0;
stream_check_ptr(__func__, streamptr);
if ( CDI_Debug )
Message("streamID = %d tsID = %d", streamptr->self, tsID);
stream_check_ptr(__func__, streamptr);
int vlistID = streamptr->vlistID;
int time_is_varying = vlistHasTime(vlistID);
......@@ -1239,9 +1220,6 @@ int streamInqTimestep(int streamID, int tsID)
int nrecs = 0;
int taxisID;
stream_t *streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
int vlistID = streamptr->vlistID;
if ( tsID < streamptr->rtsteps )
......@@ -1329,8 +1307,6 @@ void streamWriteContents(int streamID, char *cname)
{
stream_t *streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
int vlistID = streamptr->vlistID;
FILE *cnp = fopen(cname, "w");
......@@ -1427,8 +1403,6 @@ off_t streamNvals(int streamID)
{
stream_t *streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
return (streamptr->numvals);
}
......@@ -1459,8 +1433,6 @@ cdiStreamDefVlist_(int streamID, int vlistID)
{
stream_t *streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
if ( streamptr->vlistID == CDI_UNDEFID )
cdiStreamSetupVlist(streamptr, vlistDuplicate(vlistID));
else
......@@ -1486,9 +1458,6 @@ The function @func{streamInqVlist} returns the variable list of a stream.
int streamInqVlist(int streamID)
{
stream_t *streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
return (streamptr->vlistID);
}
......@@ -1496,9 +1465,6 @@ int streamInqVlist(int streamID)
void streamDefCompType(int streamID, int comptype)
{
stream_t *streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
if (streamptr->comptype != comptype)
{
streamptr->comptype = comptype;
......@@ -1510,9 +1476,6 @@ void streamDefCompType(int streamID, int comptype)
void streamDefCompLevel(int streamID, int complevel)
{
stream_t *streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
if (streamptr->complevel != complevel)
{
streamptr->complevel = complevel;
......@@ -1524,9 +1487,6 @@ void streamDefCompLevel(int streamID, int complevel)
int streamInqCompType(int streamID)
{
stream_t *streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
return (streamptr->comptype);
}
......@@ -1534,9 +1494,6 @@ int streamInqCompType(int streamID)
int streamInqCompLevel(int streamID)
{
stream_t *streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
return (streamptr->complevel);
}
......
......@@ -767,8 +767,6 @@ void streamInqGRIBinfo(int streamID, int *intnum, float *fltnum, off_t *bignum)
{
stream_t *streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
int filetype = streamptr->filetype;
if ( filetype == FILETYPE_GRB )
......
......@@ -23,9 +23,6 @@ void cdiStreamReadVar(int streamID, int varID, int memtype, void *data, int *nmi
check_parg(nmiss);
stream_t *streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
int filetype = streamptr->filetype;
*nmiss = 0;
......@@ -145,9 +142,6 @@ int cdiStreamReadVarSlice(int streamID, int varID, int levelID, int memtype, voi
check_parg(nmiss);
stream_t *streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
int filetype = streamptr->filetype;
*nmiss = 0;
......@@ -278,7 +272,6 @@ void stream_read_record(int streamID, int memtype, void *data, int *nmiss)
check_parg(nmiss);
stream_t *streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
*nmiss = 0;
......
......@@ -107,7 +107,6 @@ void streamInqRecord(int streamID, int *varID, int *levelID)
check_parg(levelID);
stream_t *streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
cdiDefAccesstype(streamID, TYPE_REC);
......@@ -154,7 +153,6 @@ The function streamDefRecord defines the meta-data of the next record.
void streamDefRecord(int streamID, int varID, int levelID)
{
stream_t *streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
int tsID = streamptr->curTsID;
......@@ -222,15 +220,11 @@ void streamDefRecord(int streamID, int varID, int levelID)
void streamCopyRecord(int streamID2, int streamID1)
{
stream_t *streamptr1 = stream_to_pointer(streamID1);
stream_t *streamptr2 = stream_to_pointer(streamID2);
stream_check_ptr(__func__, streamptr1);
stream_check_ptr(__func__, streamptr2);
int filetype1 = streamptr1->filetype;
int filetype2 = streamptr2->filetype;
int filetype = FILETYPE_UNDEF;
stream_t *streamptr1 = stream_to_pointer(streamID1),
*streamptr2 = stream_to_pointer(streamID2);
int filetype1 = streamptr1->filetype,
filetype2 = streamptr2->filetype,
filetype = FILETYPE_UNDEF;
if ( filetype1 == filetype2 ) filetype = filetype2;
else
......
......@@ -23,8 +23,6 @@ void cdiStreamWriteVar_(int streamID, int varID, int memtype, const void *data,
if (subtypeInqActiveIndex(streamptr->vars[varID].subtypeID) != 0)
Error("Writing of non-trivial subtypes not yet implemented!");
stream_check_ptr(__func__, streamptr);
// check taxis
if ( streamptr->curTsID == CDI_UNDEFID ) streamDefTimestep(streamID, 0);
......@@ -145,8 +143,6 @@ void cdiStreamWriteVarSlice(int streamID, int varID, int levelID, int memtype, c
if (subtypeInqActiveIndex(streamptr->vars[varID].subtypeID) != 0)
Error("Writing of non-trivial subtypes not yet implemented!");
stream_check_ptr(__func__, streamptr);
// check taxis
if ( streamptr->curTsID == CDI_UNDEFID ) streamDefTimestep(streamID, 0);
......@@ -270,8 +266,6 @@ cdiStreamWriteVarChunk_(int streamID, int varID, int memtype,
stream_t *streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
// streamDefineTaxis(streamID);
int filetype = streamptr->filetype;
......@@ -318,7 +312,6 @@ void stream_write_record(int streamID, int memtype, const void *data, int nmiss)
check_parg(data);
stream_t *streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
switch (streamptr->filetype)
{
......
Markdown is supported
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