From d1986edd9e0c9bc60caebb160909cb467de3a70b Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 2 Jun 2016 22:22:11 -0500 Subject: [PATCH] Simplify link-type checks in record supports --- src/std/rec/aSubRecord.c | 53 ++---------------------------------- src/std/rec/aaiRecord.c | 1 - src/std/rec/aaoRecord.c | 1 - src/std/rec/aiRecord.c | 2 -- src/std/rec/aoRecord.c | 1 - src/std/rec/boRecord.c | 1 - src/std/rec/longinRecord.c | 2 -- src/std/rec/stringinRecord.c | 1 - src/std/rec/waveformRecord.c | 1 - 9 files changed, 3 insertions(+), 60 deletions(-) diff --git a/src/std/rec/aSubRecord.c b/src/std/rec/aSubRecord.c index 0bb33dac3..0df5d5cad 100644 --- a/src/std/rec/aSubRecord.c +++ b/src/std/rec/aSubRecord.c @@ -109,10 +109,8 @@ static long init_record(aSubRecord *prec, int pass) { STATIC_ASSERT(sizeof(prec->onam)==sizeof(prec->snam)); GENFUNCPTR pfunc; - long status; int i; - status = 0; if (pass == 0) { /* Allocate memory for arrays */ initFields(&prec->fta, &prec->noa, &prec->nea, NULL, @@ -123,65 +121,20 @@ static long init_record(aSubRecord *prec, int pass) } /* Initialize the Subroutine Name Link */ - switch (prec->subl.type) { - case CONSTANT: + if (prec->subl.type == CONSTANT) { recGblInitConstantLink(&prec->subl, DBF_STRING, prec->snam); - break; - - case PV_LINK: - case DB_LINK: - case CA_LINK: - break; - - default: - recGblRecordError(S_db_badField, (void *)prec, - "aSubRecord(init_record) Bad SUBL link type"); - return S_db_badField; } /* Initialize Input Links */ for (i = 0; i < NUM_ARGS; i++) { struct link *plink = &(&prec->inpa)[i]; - switch (plink->type) { - case CONSTANT: + + if (plink->type == CONSTANT) { if ((&prec->noa)[i] < 2) recGblInitConstantLink(plink, (&prec->fta)[i], (&prec->a)[i]); - break; - - case PV_LINK: - case CA_LINK: - case DB_LINK: - break; - - default: - recGblRecordError(S_db_badField, (void *)prec, - "aSubRecord(init_record) Illegal INPUT LINK"); - status = S_db_badField; - break; } } - if (status) - return status; - - /* Initialize Output Links */ - for (i = 0; i < NUM_ARGS; i++) { - switch ((&prec->outa)[i].type) { - case CONSTANT: - case PV_LINK: - case CA_LINK: - case DB_LINK: - break; - - default: - recGblRecordError(S_db_badField, (void *)prec, - "aSubRecord(init_record) Illegal OUTPUT LINK"); - status = S_db_badField; - } - } - if (status) - return status; - /* Call the user initialization routine if there is one */ if (prec->inam[0] != 0) { pfunc = (GENFUNCPTR)registryFunctionFind(prec->inam); diff --git a/src/std/rec/aaiRecord.c b/src/std/rec/aaiRecord.c index 5b370fe4c..9e1286704 100644 --- a/src/std/rec/aaiRecord.c +++ b/src/std/rec/aaiRecord.c @@ -140,7 +140,6 @@ static long init_record(aaiRecord *prec, int pass) return 0; } - /* SIML must be a CONSTANT or a PV_LINK or a DB_LINK */ if (prec->siml.type == CONSTANT) { recGblInitConstantLink(&prec->siml,DBF_USHORT,&prec->simm); } diff --git a/src/std/rec/aaoRecord.c b/src/std/rec/aaoRecord.c index 565fd2886..83a73328e 100644 --- a/src/std/rec/aaoRecord.c +++ b/src/std/rec/aaoRecord.c @@ -140,7 +140,6 @@ static long init_record(aaoRecord *prec, int pass) return 0; } - /* SIML must be a CONSTANT or a PV_LINK or a DB_LINK */ if (prec->siml.type == CONSTANT) { recGblInitConstantLink(&prec->siml,DBF_USHORT,&prec->simm); } diff --git a/src/std/rec/aiRecord.c b/src/std/rec/aiRecord.c index fb1218b16..b13c856f8 100644 --- a/src/std/rec/aiRecord.c +++ b/src/std/rec/aiRecord.c @@ -111,12 +111,10 @@ static long init_record(void *precord,int pass) if (pass==0) return(0); - /* ai.siml must be a CONSTANT or a PV_LINK or a DB_LINK */ if (prec->siml.type == CONSTANT) { recGblInitConstantLink(&prec->siml,DBF_USHORT,&prec->simm); } - /* ai.siol must be a CONSTANT or a PV_LINK or a DB_LINK */ if (prec->siol.type == CONSTANT) { recGblInitConstantLink(&prec->siol,DBF_DOUBLE,&prec->sval); } diff --git a/src/std/rec/aoRecord.c b/src/std/rec/aoRecord.c index 63125593e..28b0c3c0c 100644 --- a/src/std/rec/aoRecord.c +++ b/src/std/rec/aoRecord.c @@ -110,7 +110,6 @@ static long init_record(aoRecord *prec, int pass) if (pass==0) return(0); - /* ao.siml must be a CONSTANT or a PV_LINK or a DB_LINK */ if (prec->siml.type == CONSTANT) { recGblInitConstantLink(&prec->siml,DBF_USHORT,&prec->simm); } diff --git a/src/std/rec/boRecord.c b/src/std/rec/boRecord.c index 55e198220..d0ed38146 100644 --- a/src/std/rec/boRecord.c +++ b/src/std/rec/boRecord.c @@ -138,7 +138,6 @@ static long init_record(boRecord *prec,int pass) if (pass==0) return(0); - /* bo.siml must be a CONSTANT or a PV_LINK or a DB_LINK */ if (prec->siml.type == CONSTANT) { recGblInitConstantLink(&prec->siml,DBF_USHORT,&prec->simm); } diff --git a/src/std/rec/longinRecord.c b/src/std/rec/longinRecord.c index b4b50ebd5..bd224ac1d 100644 --- a/src/std/rec/longinRecord.c +++ b/src/std/rec/longinRecord.c @@ -103,12 +103,10 @@ static long init_record(longinRecord *prec, int pass) if (pass==0) return(0); - /* longin.siml must be a CONSTANT or a PV_LINK or a DB_LINK */ if (prec->siml.type == CONSTANT) { recGblInitConstantLink(&prec->siml,DBF_USHORT,&prec->simm); } - /* longin.siol must be a CONSTANT or a PV_LINK or a DB_LINK */ if (prec->siol.type == CONSTANT) { recGblInitConstantLink(&prec->siol,DBF_LONG,&prec->sval); } diff --git a/src/std/rec/stringinRecord.c b/src/std/rec/stringinRecord.c index 02f454788..00988223c 100644 --- a/src/std/rec/stringinRecord.c +++ b/src/std/rec/stringinRecord.c @@ -104,7 +104,6 @@ static long init_record(stringinRecord *prec, int pass) recGblInitConstantLink(&prec->siml,DBF_USHORT,&prec->simm); } - /* stringin.siol must be a CONSTANT or a PV_LINK or a DB_LINK */ if (prec->siol.type == CONSTANT) { recGblInitConstantLink(&prec->siol,DBF_STRING,prec->sval); } diff --git a/src/std/rec/waveformRecord.c b/src/std/rec/waveformRecord.c index 293be79af..c6ca2a04a 100644 --- a/src/std/rec/waveformRecord.c +++ b/src/std/rec/waveformRecord.c @@ -111,7 +111,6 @@ static long init_record(waveformRecord *prec, int pass) return 0; } - /* wf.siml must be a CONSTANT or a PV_LINK or a DB_LINK */ if (prec->siml.type == CONSTANT) { recGblInitConstantLink(&prec->siml,DBF_USHORT,&prec->simm); }