Merge ~epics-core/epics-base/+git/fixups:aSubInit into ~epics-core/epics-base/+git/epics-base:3.14

Proposed by mdavidsaver
Status: Merged
Merged at revision: 52787995757c2f9ec4906cbb6092f1cc4ae0520b
Proposed branch: ~epics-core/epics-base/+git/fixups:aSubInit
Merge into: ~epics-core/epics-base/+git/epics-base:3.14
Diff against target: 18 lines (+8/-0)
1 file modified
src/rec/aSubRecord.c (+8/-0)
Reviewer Review Type Date Requested Status
Andrew Johnson Approve
Review via email: mp+333414@code.launchpad.net

Description of the change

For aSubRecord, handle EFLG="On Change" when an initial function (INAM) is used. Copy VAL* -> OVL* and NOV* -> ONV*.

Missed during my previous round of old-value initialization handling b63e381fbefd0336cb3109f9af4c5cfa757ae1d2

An almost trivial change. If we weren't preparing for a release I'd just push this, but it has no test coverage, and I'm not likely to produce any in the next few days.

To post a comment you must log in.
Revision history for this message
Andrew Johnson (anj) wrote :

Thanks for waiting for a review as you'd have been wrong to push this change as it is.

The NOVx fields do not hold a byte-count, so feeding their values directly to memcpy() would only be correct when FTVx=CHAR or UCHAR, not for other data types. The correct number of bytes to copy should be calculated with
   (&prec->nova)[i] * dbValueSize((&prec->ftva)[i])

Personally I would also save the element count in a variable to avoid it being looked up twice inside the loop, but compilers may be clever enough to do that kind of thing for themselves now.

review: Needs Fixing
Revision history for this message
Andrew Johnson (anj) wrote :

Oh, and it shouldn't be using the NOVx fields for the element count at all, those hold the max number of elements that can be stored, not the current number of values present which is kept in the NEVx fields. Look at the monitor() routine for the correct usage.

Now I *really* must go back to bed.

Revision history for this message
Andrew Johnson (anj) wrote :

Fixing this now, and will merge the other as well.

Revision history for this message
Andrew Johnson (anj) wrote :

Fixed, merging.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/rec/aSubRecord.c b/src/rec/aSubRecord.c
2index e3983ed..087b35d 100644
3--- a/src/rec/aSubRecord.c
4+++ b/src/rec/aSubRecord.c
5@@ -207,6 +207,14 @@ static long init_record(aSubRecord *prec, int pass)
6 }
7 strcpy(prec->onam, prec->snam);
8 prec->oval = prec->val;
9+ for (i = 0; i < NUM_ARGS; i++) {
10+ epicsUInt32 nev = (&prec->neva)[i];
11+
12+ (&prec->onva)[i] = nev;
13+ if (nev)
14+ memcpy((&prec->ovla)[i], (&prec->vala)[i],
15+ dbValueSize((&prec->ftva)[i]) * nev);
16+ }
17 return 0;
18 }
19

Subscribers

People subscribed via source and target branches