distinction between an optional member and a member encoded with a pointer


git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@302 59561ff5-6e30-0410-9f3c-9617f08c8826
diff --git a/skeletons/constr_SET.c b/skeletons/constr_SET.c
index 67816a7..f103fa3 100644
--- a/skeletons/constr_SET.c
+++ b/skeletons/constr_SET.c
@@ -294,8 +294,8 @@
 		 * and also a type of containment (it may be contained
 		 * as pointer or using inline inclusion).
 		 */
-		if(elements[edx].optional) {
-			/* Optional member, hereby, a simple pointer */
+		if(elements[edx].flags & ATF_POINTER) {
+			/* Member is a pointer to another structure */
 			memb_ptr2 = (void **)((char *)st + elements[edx].memb_offset);
 		} else {
 			/*
@@ -475,7 +475,7 @@
 		/*
 		 * Compute the length of the encoding of this member.
 		 */
-		if(elm->optional) {
+		if(elm->flags & ATF_POINTER) {
 			memb_ptr = *(void **)((char *)ptr + elm->memb_offset);
 			if(!memb_ptr) {
 				if(t2m_build_own) {
@@ -551,7 +551,7 @@
 		/* Encode according to the tag order */
 		elm = &td->elements[t2m[edx].el_no];
 
-		if(elm->optional) {
+		if(elm->flags & ATF_POINTER) {
 			memb_ptr = *(void **)((char *)ptr + elm->memb_offset);
 			if(!memb_ptr) continue;
 		} else {
@@ -594,7 +594,7 @@
 		asn1_TYPE_member_t *elm = &td->elements[edx];
 		const void *memb_ptr;
 
-		if(elm->optional) {
+		if(elm->flags & ATF_POINTER) {
 			memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset);
 			if(!memb_ptr) continue;
 		} else {
@@ -636,7 +636,7 @@
 	for(edx = 0; edx < td->elements_count; edx++) {
 		asn1_TYPE_member_t *elm = &td->elements[edx];
 		void *memb_ptr;
-		if(elm->optional) {
+		if(elm->flags & ATF_POINTER) {
 			memb_ptr = *(void **)((char *)ptr + elm->memb_offset);
 			if(memb_ptr)
 				elm->type->free_struct(elm->type, memb_ptr, 0);
@@ -671,19 +671,15 @@
 		asn1_TYPE_member_t *elm = &td->elements[edx];
 		const void *memb_ptr;
 
-		if(elm->optional) {
+		if(elm->flags & ATF_POINTER) {
 			memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset);
 			if(!memb_ptr) {
-				if(ASN_SET_ISPRESENT2(
-					&(specs->_mandatory_elements), edx)) {
-					_ASN_ERRLOG(app_errlog, app_key,
-						"%s: mandatory element "
-						"%s absent (%s:%d)",
-						td->name, elm->name,
-						__FILE__, __LINE__);
-					return -1;
-				}
-				continue;
+				if(elm->optional)
+					continue;
+				_ASN_ERRLOG(app_errlog, app_key,
+				"%s: mandatory element %s absent (%s:%d)",
+				td->name, elm->name, __FILE__, __LINE__);
+				return -1;
 			}
 		} else {
 			memb_ptr = (const void *)((const char *)sptr + elm->memb_offset);