The cif_write() function currently has no special handling for loops without any packets. It conditions its implicit promise of well formed CIF output on the premise that the input data conform to the CIF data model. Function cif_container_prune() exists to help the user ensure that.
However, it would be preferable to produce well-formed output unconditionally. It is impractical to prevent an in-memory CIF from containing empty loops, so cif_write() should deal with them. There are two reasonable possibilities:
- Such loops could be suppressed
- Such loops could be given a synthetic packet containing all unknown-value placeholders
The latter would be more easily implemented within the current framework.
In any case, perhaps it would be best for the choice of behavior to be controlled by an option.