Store original INP/OUT text in link in case DTYP changes later.

This commit is contained in:
2010-06-22 17:35:48 -05:00
committed by Andrew Johnson
parent 320ff29c4a
commit f1ba442133
3 changed files with 21 additions and 0 deletions

View File

@@ -12,6 +12,10 @@
<h2 align="center">Changes between 3.14.11 and 3.14.12</h2>
<!-- Insert new items immediately below here ... -->
<h4>DTYP and INP/OUT order</h4>
<p>The fields DTYP and INP/OUT can now be specified in any order.</p>
<h4>Rewrite epicsThreadOnce()</h4>
<p>Michael Davidsaver suggested a better implementation of epicsThreadOnce()

View File

@@ -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;

View File

@@ -183,6 +183,7 @@ union value{
struct link{
union value value;
short type;
char *text; /* original INP/OUT link text */
};
typedef struct link DBLINK;