diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index 9b3ce378e..70b24ac5c 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -12,6 +12,10 @@
The fields DTYP and INP/OUT can now be specified in any order.
+Michael Davidsaver suggested a better implementation of epicsThreadOnce() diff --git a/src/dbStatic/dbStaticLib.c b/src/dbStatic/dbStaticLib.c index 8871ad64c..67275bbd8 100644 --- a/src/dbStatic/dbStaticLib.c +++ b/src/dbStatic/dbStaticLib.c @@ -277,6 +277,19 @@ static long setLinkType(DBENTRY *pdbentry) plink = (DBLINK *)pdbentry->pfield; if (plink->type == link_type) goto done; + if (plink->text) + { + /* re-parse link text when DTYP has changed */ + char * link_text; + link_text = plink->text; + plink->text = NULL; + dbFreeLinkContents(plink); + plink->type = link_type; + dbPutString(pdbentry, link_text); + free(link_text); + goto done; + } + type = plink->type; if ((type == CONSTANT || type == PV_LINK || type == DB_LINK || type == CA_LINK) && (link_type == CONSTANT || link_type == PV_LINK)) goto done; @@ -331,6 +344,7 @@ void dbFreeLinkContents(struct link *plink) epicsPrintf("dbFreeLink called but link type unknown\n"); } if(parm && (parm != pNullString)) free((void *)parm); + if(plink->text) free(plink->text); memset((char *)plink,0,sizeof(struct link)); } @@ -2224,6 +2238,8 @@ long epicsShareAPI dbPutString(DBENTRY *pdbentry,const char *pstring) errMessage(status,"in dbPutString from setLinkType"); return status; } + /* store link text in case DTYP changes later */ + plink->text = epicsStrDup(pstring); } if (strlen(pstring) >= sizeof(string)) { status = S_dbLib_badField; diff --git a/src/dbStatic/link.h b/src/dbStatic/link.h index a43c5711e..3d97fa1a9 100644 --- a/src/dbStatic/link.h +++ b/src/dbStatic/link.h @@ -183,6 +183,7 @@ union value{ struct link{ union value value; short type; + char *text; /* original INP/OUT link text */ }; typedef struct link DBLINK;