Code review comment for lp:~epics-core/epics-base/link-support-2

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

Yes, it feels a bit strange but both routines are needed and do almost the same thing, but with different arguments. jlif:free_jlink() is called when a jlink doesn't parse correctly; it doesn't have a plink or an lset pointer yet, so we couldn't call the lset::removeLink() method at this point anyway. The lset::removeLink() routine is called after a link has been opened when the link field's value gets overwritten, and is also needed for the CA_LINK and DB_LINK types which don't have a jlif.

A link that has embedded child links must call all their free_jlink() routines from its free_jlink(), and all their removeLink() routines from its removeLink() routine.

Unfortunately it is fairly easy for the two routines to get out of step during development, as evidenced by my lnkCalc where I forgot to update removeLink() after adding some fields for the report displays; another fix committed!

I started working on the test code again and found a major flaw: When I moved the JSON parsing to before record initialization I forgot that while parsing a JSON link for an OUT/INP field we need to be able to tell whether DTYP is set to a device support like "Soft Channel" (when link name lookup must occur while parsing) or to "My JSON-addressed device support" (when it shouldn't). I'm going to need to sleep on this to work out what to do, but for now we can't handle JSON_LINK addresses for device support routines.

« Back to merge proposal