asn1c 释放Set或SequenceOf使用asn_set_empty
asn_set_empty
/*
 * Free the contents of the set, do not free the set itself.
 */asn_set_empty用法:
asn_set_empty(&pv2x->content->choice.signedData->signer.choice.certificate);
有的地方使用ASN_STRUCT_FREE_CONTENTS_ONLY,但好像还是有些差异。
/*
 * Free memory used by the members of the structure without freeing
 * the structure pointer itself.
 * (Retaining the pointer may be useful in case the structure is allocated
 *  statically or arranged on the stack, yet its elements are dynamic.)
 * AVOID using it in the application code;
 * Use a safer ASN_STRUCT_RESET() instead.
 */
#define ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF, ptr) \
    (asn_DEF).op->free_struct(&(asn_DEF), (ptr), ASFM_FREE_UNDERLYING)
本文链接地址:https://const.net.cn/192.html