Move type operations to another structure
Every type has free, print, check_constraints, ber_decoder, der_encoder,
xer_decoder, xer_encoder, uper_decoder, uper_encoder and outmost_tag
operations. We move them out to a separate structure asn_TYPE_operation_t.
Combined with previous logic simplification, these operations are based
on ASN.1 basic types, constructed types and string types. So we can
reduce the space occupied by asn_TYPE_descriptor_t variables.
diff --git a/skeletons/per_encoder.c b/skeletons/per_encoder.c
index 2ccfdf0..5e3a77a 100644
--- a/skeletons/per_encoder.c
+++ b/skeletons/per_encoder.c
@@ -121,13 +121,13 @@
uper_encode_internal(asn_TYPE_descriptor_t *td,
const asn_per_constraints_t *constraints, void *sptr,
asn_app_consume_bytes_f *cb, void *app_key) {
- asn_per_outp_t po;
+ asn_per_outp_t po;
asn_enc_rval_t er;
/*
* Invoke type-specific encoder.
*/
- if(!td || !td->uper_encoder)
+ if(!td || !td->op->uper_encoder)
ASN__ENCODE_FAILED; /* PER is not compiled in */
po.buffer = po.tmpspace;
@@ -137,7 +137,7 @@
po.op_key = app_key;
po.flushed_bytes = 0;
- er = td->uper_encoder(td, constraints, sptr, &po);
+ er = td->op->uper_encoder(td, constraints, sptr, &po);
if(er.encoded != -1) {
size_t bits_to_flush;