From 48eb4ff4acb8897976c2ea752fe3454409e60faf Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 11 May 2020 15:23:19 -0700 Subject: [PATCH] dbRecordtypeFieldItem() avoid excess strcmp() only one is going to match. --- .../database/src/ioc/dbStatic/dbLexRoutines.c | 33 +++++++------------ 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/modules/database/src/ioc/dbStatic/dbLexRoutines.c b/modules/database/src/ioc/dbStatic/dbLexRoutines.c index 91b3acc68..fbefd84bf 100644 --- a/modules/database/src/ioc/dbStatic/dbLexRoutines.c +++ b/modules/database/src/ioc/dbStatic/dbLexRoutines.c @@ -576,20 +576,16 @@ static void dbRecordtypeFieldItem(char *name,char *value) yyerror("Illegal Access Security value: Must be ASL0 or ASL1"); } return; - } - if(strcmp(name,"initial")==0) { + } else if(strcmp(name,"initial")==0) { pdbFldDes->initial = epicsStrDup(value); return; - } - if(strcmp(name,"promptgroup")==0) { + } else if(strcmp(name,"promptgroup")==0) { pdbFldDes->promptgroup = findOrAddGuiGroup(value); return; - } - if(strcmp(name,"prompt")==0) { + } else if(strcmp(name,"prompt")==0) { pdbFldDes->prompt = epicsStrDup(value); return; - } - if(strcmp(name,"special")==0) { + } else if(strcmp(name,"special")==0) { int i; for(i=0; iprocess_passive = TRUE; } else if((strcmp(value,"NO")==0) || (strcmp(value,"FALSE")==0)) { @@ -612,13 +607,11 @@ static void dbRecordtypeFieldItem(char *name,char *value) yyerror("Illegal 'pp' value, must be YES/NO/TRUE/FALSE"); } return; - } - if(strcmp(name,"interest")==0) { + } else if(strcmp(name,"interest")==0) { if(sscanf(value,"%hd",&pdbFldDes->interest)!=1) yyerror("Illegal 'interest' value, must be integer"); return; - } - if(strcmp(name,"base")==0) { + } else if(strcmp(name,"base")==0) { if(strcmp(value,"DECIMAL")==0) { pdbFldDes->base = CT_DECIMAL; } else if(strcmp(value,"HEX")==0) { @@ -627,23 +620,19 @@ static void dbRecordtypeFieldItem(char *name,char *value) yyerror("Illegal 'base' value, must be DECIMAL/HEX"); } return; - } - if(strcmp(name,"size")==0) { + } else if(strcmp(name,"size")==0) { if(sscanf(value,"%hd",&pdbFldDes->size)!=1) yyerror("Illegal 'size' value, must be integer"); return; - } - if(strcmp(name,"extra")==0) { + } else if(strcmp(name,"extra")==0) { pdbFldDes->extra = epicsStrDup(value); return; - } - if(strcmp(name,"menu")==0) { + } else if(strcmp(name,"menu")==0) { pdbFldDes->ftPvt = (dbMenu *)dbFindMenu(pdbbase,value); if(!pdbbase->ignoreMissingMenus && !pdbFldDes->ftPvt) yyerrorAbort("menu not found"); return; - } - if(strcmp(name,"prop")==0) { + } else if(strcmp(name,"prop")==0) { if(strcmp(value, "YES")==0) pdbFldDes->prop = 1; else