dbStatic: fix CONSTANT links

constantStr==NULL and constantStr=="" have different
meanings for recGblInitConstantLink() which is used with DOL.
constantStr should remain NULL unless explicitly set
by either initial("") or field(..., "")
This commit is contained in:
Michael Davidsaver
2015-03-17 11:34:36 -04:00
parent 0d41dd0113
commit e7037cc519
2 changed files with 4 additions and 3 deletions
+2 -1
View File
@@ -1915,7 +1915,8 @@ long dbInitRecordLinks(dbRecordType *rtyp, struct dbCommon *prec)
plink->type = CONSTANT;
switch (plink->type) {
case CONSTANT: plink->value.constantStr = callocMustSucceed(1, 1, "init CONSTANT link"); break;
/* constantStr is allowed to remain NULL if plink->text==NULL */
case CONSTANT: plink->value.constantStr = NULL; break;
case PV_LINK: plink->value.pv_link.pvname = callocMustSucceed(1, 1, "init PV_LINK"); break;
case VME_IO: plink->value.vmeio.parm = pNullString; break;
case CAMAC_IO: plink->value.camacio.parm = pNullString; break;
+2 -2
View File
@@ -270,9 +270,9 @@ long dbAllocRecord(DBENTRY *pdbentry,const char *precordName)
plink->type = CONSTANT;
if(pflddes->initial) {
plink->value.constantStr =
plink->text =
dbCalloc(strlen(pflddes->initial)+1,sizeof(char));
strcpy(plink->value.constantStr,pflddes->initial);
strcpy(plink->text,pflddes->initial);
}
}
break;