From ca46bf70b7f6c6bf35e3babd6c94589628042a2d Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 23 Jun 2015 17:06:54 -0500 Subject: [PATCH] Fixes to attribute handling in dbStaticLib From Peter Leban of i-tech (Libera) --- src/dbStatic/dbStaticLib.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/dbStatic/dbStaticLib.c b/src/dbStatic/dbStaticLib.c index 08ec137e1..a3648f3bf 100644 --- a/src/dbStatic/dbStaticLib.c +++ b/src/dbStatic/dbStaticLib.c @@ -1347,7 +1347,7 @@ long epicsShareAPI dbPutRecordAttribute( pnew = dbCalloc(1,sizeof(dbRecordAttribute)); if(pattribute) { - ellInsert(&precordType->attributeList,&pattribute->node, + ellInsert(&precordType->attributeList,pattribute->node.previous, &pnew->node); } else { ellAdd(&precordType->attributeList,&pnew->node); @@ -1381,11 +1381,16 @@ long epicsShareAPI dbGetAttributePart(DBENTRY *pdbentry, const char **ppname) int nameLen = strlen(pattribute->name); int compare = strncmp(pattribute->name, pname, nameLen); int ch = pname[nameLen]; - if (compare == 0 && !(ch == '_' || isalnum(ch))) { - pdbentry->pflddes = pattribute->pdbFldDes; - pdbentry->pfield = pattribute->value; - *ppname = &pname[nameLen]; - return 0; + if (compare == 0) { + if (!(ch == '_' || isalnum(ch))) { + pdbentry->pflddes = pattribute->pdbFldDes; + pdbentry->pfield = pattribute->value; + *ppname = &pname[nameLen]; + return 0; + } + if (strlen(pname) > nameLen) { + compare = -1; + } } if (compare >= 0) break; pattribute = (dbRecordAttribute *)ellNext(&pattribute->node);