Merge pull request #96 from brchiu/fix_declaration_inside_parameter_list_warning

Fix 'declaration inside parameter list' warning
diff --git a/AUTHORS b/AUTHORS
index 03f9b01..9a3f1a7 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,3 +1,10 @@
-Lev Walkin <vlm@lionet.info>
+Full list of copyright holders:
+
+Bartosz Marcinkiewicz <bma@megawatt.com.pl>
+Bent Nicolaisen <BN@JAI.com>
+brchiu @ github
+Daniele Varrazzo <daniele.varrazzo@gmail.com>
 mkhon @ github
+Lev Walkin <vlm@lionet.info>
+Wim L <wiml@omnigroup.com>
 ymbirtt @ github
diff --git a/ChangeLog b/ChangeLog
index 78e26da..3c1a829 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 
 0.9.??:
+
+0.9.28: 2017-03-26
     * PER decoding: avoid memory leak on error. By github.com/simo5
     * Constness patch #46 by Wim L <wiml@omnigroup.com> (41bbf1c..78d604f).
     Build issues:
diff --git a/LICENSE b/LICENSE
index 81581a1..306464b 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2003-2016  Lev Walkin <vlm@lionet.info> and contributors.
+Copyright (c) 2003-2017  Lev Walkin <vlm@lionet.info> and contributors.
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
diff --git a/Makefile.am b/Makefile.am
index 870ee8f..f0cd168 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -9,6 +9,6 @@
 
 docsdir = $(datadir)/doc/asn1c
 
-docs_DATA = README.md FAQ ChangeLog BUGS TODO
+docs_DATA = README.md INSTALL.md FAQ ChangeLog BUGS TODO
 
-EXTRA_DIST = README.md FAQ LICENSE BUGS
+EXTRA_DIST = README.md INSTALL.md FAQ LICENSE BUGS
diff --git a/configure.ac b/configure.ac
index 64a37a9..13ef78d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([asn1c],[0.9.28],[vlm@lionet.info])
+AC_INIT([asn1c],[0.9.29],[vlm@lionet.info])
 
 AC_CONFIG_AUX_DIR(config)
 AC_CONFIG_HEADER([config.h])
diff --git a/examples/sample.makefile.regen b/examples/sample.makefile.regen
index 50551b2..66bec0a 100755
--- a/examples/sample.makefile.regen
+++ b/examples/sample.makefile.regen
@@ -113,7 +113,7 @@
 	echo '	done; done; fi'
 	echo "	@if test -f sample-${ASN1PDU}-1.per ; then \\"
 	echo "	for f in sample-*-[1-9].per; do \\"
-	echo '	pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z-]+)-[0-9].*/\1/"`; \'
+	echo '	pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z-]+)-[0-9].*/\\1/"`; \'
 	echo '	for b in 1 17 33 980 8192; do \'
 	echo '	echo "Recoding $$f into DER into XER and back ($$b)..."; \'
 	echo '	./${TARGET} -b $$b -p $$pdu -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \'
diff --git a/libasn1fix/asn1fix_crange.c b/libasn1fix/asn1fix_crange.c
index 311c727..4c1f321 100644
--- a/libasn1fix/asn1fix_crange.c
+++ b/libasn1fix/asn1fix_crange.c
@@ -673,10 +673,8 @@
 			range->right = tmp;
 		}
 
-		if(range->elements) {
-			free(range->elements);
-			range->elements = 0;
-		}
+		free(range->elements);
+		range->elements = 0;
 		range->el_size = 0;
 		return 0;
 	}
diff --git a/libasn1fix/asn1fix_tags.c b/libasn1fix/asn1fix_tags.c
index db4d4ed..d57e37e 100644
--- a/libasn1fix/asn1fix_tags.c
+++ b/libasn1fix/asn1fix_tags.c
@@ -166,7 +166,7 @@
 	arg.expr = expr;
 
 	count = asn1f_fetch_tags_impl(&arg, &tags, 0, 0, flags);
-	if(count <= 0 && tags) {
+	if (count <= 0) {
 		free(tags);
 		tags = 0;
 	}
diff --git a/libasn1parser/asn1p_constr.c b/libasn1parser/asn1p_constr.c
index 0b1e892..008ad40 100644
--- a/libasn1parser/asn1p_constr.c
+++ b/libasn1parser/asn1p_constr.c
@@ -23,14 +23,10 @@
 asn1p_constraint_free(asn1p_constraint_t *ct) {
 	if(ct) {
 
-		if(ct->containedSubtype)
-			asn1p_value_free(ct->containedSubtype);
-		if(ct->value)
-			asn1p_value_free(ct->value);
-		if(ct->range_start)
-			asn1p_value_free(ct->range_start);
-		if(ct->range_stop)
-			asn1p_value_free(ct->range_stop);
+		asn1p_value_free(ct->containedSubtype);
+		asn1p_value_free(ct->value);
+		asn1p_value_free(ct->range_start);
+		asn1p_value_free(ct->range_stop);
 
 		if(ct->elements) {
 			while(ct->el_count--) {
diff --git a/libasn1parser/asn1p_expr.c b/libasn1parser/asn1p_expr.c
index b7a03ec..46e54a3 100644
--- a/libasn1parser/asn1p_expr.c
+++ b/libasn1parser/asn1p_expr.c
@@ -246,20 +246,13 @@
 		}
 
 		free(expr->Identifier);
-		if(expr->reference)
-			asn1p_ref_free(expr->reference);
-		if(expr->constraints)
-			asn1p_constraint_free(expr->constraints);
-		if(expr->combined_constraints)
-			asn1p_constraint_free(expr->combined_constraints);
-		if(expr->lhs_params)
-			asn1p_paramlist_free(expr->lhs_params);
-		if(expr->value)
-			asn1p_value_free(expr->value);
-		if(expr->marker.default_value)
-			asn1p_value_free(expr->marker.default_value);
-		if(expr->with_syntax)
-			asn1p_wsyntx_free(expr->with_syntax);
+		asn1p_ref_free(expr->reference);
+		asn1p_constraint_free(expr->constraints);
+		asn1p_constraint_free(expr->combined_constraints);
+		asn1p_paramlist_free(expr->lhs_params);
+		asn1p_value_free(expr->value);
+		asn1p_value_free(expr->marker.default_value);
+		asn1p_wsyntx_free(expr->with_syntax);
 
 		if(expr->data && expr->data_free)
 			expr->data_free(expr->data);
diff --git a/libasn1parser/asn1p_param.c b/libasn1parser/asn1p_param.c
index 6fd7f21..df6054e 100644
--- a/libasn1parser/asn1p_param.c
+++ b/libasn1parser/asn1p_param.c
@@ -27,8 +27,7 @@
 		if(pl->params) {
 			int i = pl->params_count;
 			while(i--) {
-				if(pl->params[i].governor)
-					asn1p_ref_free(pl->params[i].governor);
+				asn1p_ref_free(pl->params[i].governor);
 				free(pl->params[i].argument);
 				pl->params[i].governor = 0;
 				pl->params[i].argument = 0;
@@ -82,8 +81,7 @@
 		pl->params_count++;
 		return 0;
 	} else {
-		if(pl->params[pl->params_count].governor)
-			asn1p_ref_free(pl->params[pl->params_count].governor);
+		asn1p_ref_free(pl->params[pl->params_count].governor);
 		return -1;
 	}
 }
diff --git a/libasn1parser/asn1p_y.c b/libasn1parser/asn1p_y.c
index e15fc02..9d355b7 100644
--- a/libasn1parser/asn1p_y.c
+++ b/libasn1parser/asn1p_y.c
@@ -430,7 +430,7 @@
 	} tv_nametag;
 }
 /* Line 193 of yacc.c.  */
-#line 434 "y.tab.c"
+#line 434 "asn1p_y.c"
 	YYSTYPE;
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
@@ -443,7 +443,7 @@
 
 
 /* Line 216 of yacc.c.  */
-#line 447 "y.tab.c"
+#line 447 "asn1p_y.c"
 
 #ifdef short
 # undef short
@@ -2825,8 +2825,8 @@
 		checkmem((yyval.a_plist));
 		ret = asn1p_paramlist_add_param((yyval.a_plist), (yyvsp[(1) - (1)].a_parg).governor, (yyvsp[(1) - (1)].a_parg).argument);
 		checkmem(ret == 0);
-		if((yyvsp[(1) - (1)].a_parg).governor) asn1p_ref_free((yyvsp[(1) - (1)].a_parg).governor);
-		if((yyvsp[(1) - (1)].a_parg).argument) free((yyvsp[(1) - (1)].a_parg).argument);
+		asn1p_ref_free((yyvsp[(1) - (1)].a_parg).governor);
+		free((yyvsp[(1) - (1)].a_parg).argument);
 	}
     break;
 
@@ -2837,8 +2837,8 @@
 		(yyval.a_plist) = (yyvsp[(1) - (3)].a_plist);
 		ret = asn1p_paramlist_add_param((yyval.a_plist), (yyvsp[(3) - (3)].a_parg).governor, (yyvsp[(3) - (3)].a_parg).argument);
 		checkmem(ret == 0);
-		if((yyvsp[(3) - (3)].a_parg).governor) asn1p_ref_free((yyvsp[(3) - (3)].a_parg).governor);
-		if((yyvsp[(3) - (3)].a_parg).argument) free((yyvsp[(3) - (3)].a_parg).argument);
+		asn1p_ref_free((yyvsp[(3) - (3)].a_parg).governor);
+		free((yyvsp[(3) - (3)].a_parg).argument);
 	}
     break;
 
@@ -4795,7 +4795,7 @@
 
 
 /* Line 1267 of yacc.c.  */
-#line 4799 "y.tab.c"
+#line 4799 "asn1p_y.c"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
diff --git a/libasn1parser/asn1p_y.h b/libasn1parser/asn1p_y.h
index 9963cde..2cec4ee 100644
--- a/libasn1parser/asn1p_y.h
+++ b/libasn1parser/asn1p_y.h
@@ -294,7 +294,7 @@
 	} tv_nametag;
 }
 /* Line 1529 of yacc.c.  */
-#line 298 "y.tab.h"
+#line 298 "asn1p_y.h"
 	YYSTYPE;
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
diff --git a/libasn1parser/asn1p_y.y b/libasn1parser/asn1p_y.y
index aae339b..910989a 100644
--- a/libasn1parser/asn1p_y.y
+++ b/libasn1parser/asn1p_y.y
@@ -850,16 +850,16 @@
 		checkmem($$);
 		ret = asn1p_paramlist_add_param($$, $1.governor, $1.argument);
 		checkmem(ret == 0);
-		if($1.governor) asn1p_ref_free($1.governor);
-		if($1.argument) free($1.argument);
+		asn1p_ref_free($1.governor);
+		free($1.argument);
 	}
 	| ParameterArgumentList ',' ParameterArgumentName {
 		int ret;
 		$$ = $1;
 		ret = asn1p_paramlist_add_param($$, $3.governor, $3.argument);
 		checkmem(ret == 0);
-		if($3.governor) asn1p_ref_free($3.governor);
-		if($3.argument) free($3.argument);
+		asn1p_ref_free($3.governor);
+		free($3.argument);
 	}
 	;
 	
diff --git a/skeletons/ANY.c b/skeletons/ANY.c
index 77024bd..055138d 100644
--- a/skeletons/ANY.c
+++ b/skeletons/ANY.c
@@ -6,7 +6,7 @@
 #include <ANY.h>
 #include <errno.h>
 
-static asn_OCTET_STRING_specifics_t asn_DEF_ANY_specs = {
+static asn_OCTET_STRING_specifics_t asn_SPC_ANY_specs = {
 	sizeof(ANY_t),
 	offsetof(ANY_t, _asn_ctx),
 	ASN_OSUBV_ANY
@@ -26,7 +26,7 @@
 	0, 0, 0, 0,
 	0,	/* No PER visible constraints */
 	0, 0,	/* No members */
-	&asn_DEF_ANY_specs,
+	&asn_SPC_ANY_specs,
 };
 
 
diff --git a/skeletons/BIT_STRING.c b/skeletons/BIT_STRING.c
index 997ff41..7b8e975 100644
--- a/skeletons/BIT_STRING.c
+++ b/skeletons/BIT_STRING.c
@@ -12,7 +12,7 @@
 static const ber_tlv_tag_t asn_DEF_BIT_STRING_tags[] = {
 	(ASN_TAG_CLASS_UNIVERSAL | (3 << 2))
 };
-static asn_OCTET_STRING_specifics_t asn_DEF_BIT_STRING_specs = {
+static asn_OCTET_STRING_specifics_t asn_SPC_BIT_STRING_specs = {
 	sizeof(BIT_STRING_t),
 	offsetof(BIT_STRING_t, _asn_ctx),
 	ASN_OSUBV_BIT
@@ -38,7 +38,7 @@
 	  / sizeof(asn_DEF_BIT_STRING_tags[0]),
 	0,	/* No PER visible constraints */
 	0, 0,	/* No members */
-	&asn_DEF_BIT_STRING_specs
+	&asn_SPC_BIT_STRING_specs
 };
 
 /*
diff --git a/skeletons/BMPString.c b/skeletons/BMPString.c
index 8beaabd..b6348c1 100644
--- a/skeletons/BMPString.c
+++ b/skeletons/BMPString.c
@@ -13,7 +13,7 @@
 	(ASN_TAG_CLASS_UNIVERSAL | (30 << 2)),	/* [UNIVERSAL 30] IMPLICIT ...*/
 	(ASN_TAG_CLASS_UNIVERSAL | (4 << 2))	/* ... OCTET STRING */
 };
-static asn_OCTET_STRING_specifics_t asn_DEF_BMPString_specs = {
+static asn_OCTET_STRING_specifics_t asn_SPC_BMPString_specs = {
 	sizeof(BMPString_t),
 	offsetof(BMPString_t, _asn_ctx),
 	ASN_OSUBV_U16	/* 16-bits character */
@@ -44,7 +44,7 @@
 	  / sizeof(asn_DEF_BMPString_tags[0]),
 	&asn_DEF_BMPString_constraints,
 	0, 0,	/* No members */
-	&asn_DEF_BMPString_specs
+	&asn_SPC_BMPString_specs
 };
 
 /*
diff --git a/skeletons/Makefile.am b/skeletons/Makefile.am
index f15a695..9978946 100644
--- a/skeletons/Makefile.am
+++ b/skeletons/Makefile.am
@@ -6,7 +6,7 @@
 		${srcdir}/*.[ch]		\
 		${srcdir}/file-dependencies
 
-smodsdir=$(pkgdata)
+smodsdir=$(pkgdatadir)
 
 nobase_dist_smods_DATA =     \
 	standard-modules/README  \
diff --git a/skeletons/OCTET_STRING.c b/skeletons/OCTET_STRING.c
index 5420ded..ed6e59a 100644
--- a/skeletons/OCTET_STRING.c
+++ b/skeletons/OCTET_STRING.c
@@ -14,7 +14,7 @@
 static const ber_tlv_tag_t asn_DEF_OCTET_STRING_tags[] = {
 	(ASN_TAG_CLASS_UNIVERSAL | (4 << 2))
 };
-static const asn_OCTET_STRING_specifics_t asn_DEF_OCTET_STRING_specs = {
+static const asn_OCTET_STRING_specifics_t asn_SPC_OCTET_STRING_specs = {
 	sizeof(OCTET_STRING_t),
 	offsetof(OCTET_STRING_t, _asn_ctx),
 	ASN_OSUBV_STR
@@ -45,7 +45,7 @@
 	  / sizeof(asn_DEF_OCTET_STRING_tags[0]),
 	0,	/* No PER visible constraints */
 	0, 0,	/* No members */
-	&asn_DEF_OCTET_STRING_specs
+	&asn_SPC_OCTET_STRING_specs
 };
 
 #undef	_CH_PHASE
@@ -170,7 +170,7 @@
 	void **sptr, const void *buf_ptr, size_t size, int tag_mode) {
 	asn_OCTET_STRING_specifics_t *specs = td->specifics
 				? (asn_OCTET_STRING_specifics_t *)td->specifics
-				: &asn_DEF_OCTET_STRING_specs;
+				: &asn_SPC_OCTET_STRING_specs;
 	BIT_STRING_t *st = (BIT_STRING_t *)*sptr;
 	asn_dec_rval_t rval;
 	asn_struct_ctx_t *ctx;
@@ -519,7 +519,7 @@
 	asn_enc_rval_t er;
 	asn_OCTET_STRING_specifics_t *specs = td->specifics
 				? (asn_OCTET_STRING_specifics_t *)td->specifics
-				: &asn_DEF_OCTET_STRING_specs;
+				: &asn_SPC_OCTET_STRING_specs;
 	BIT_STRING_t *st = (BIT_STRING_t *)sptr;
 	enum asn_OS_Subvariant type_variant = specs->subvariant;
 	int fix_last_byte = 0;
@@ -1112,7 +1112,7 @@
 	OCTET_STRING_t *st = (OCTET_STRING_t *)*sptr;
 	asn_OCTET_STRING_specifics_t *specs = td->specifics
 				? (asn_OCTET_STRING_specifics_t *)td->specifics
-				: &asn_DEF_OCTET_STRING_specs;
+				: &asn_SPC_OCTET_STRING_specs;
 	const char *xml_tag = opt_mname ? opt_mname : td->xml_tag;
 	asn_struct_ctx_t *ctx;		/* Per-structure parser context */
 	asn_dec_rval_t rval;		/* Return value from the decoder */
@@ -1327,7 +1327,7 @@
 
 	asn_OCTET_STRING_specifics_t *specs = td->specifics
 		? (asn_OCTET_STRING_specifics_t *)td->specifics
-		: &asn_DEF_OCTET_STRING_specs;
+		: &asn_SPC_OCTET_STRING_specs;
 	asn_per_constraints_t *pc = constraints ? constraints
 				: td->per_constraints;
 	asn_per_constraint_t *cval;
@@ -1498,7 +1498,7 @@
 
 	asn_OCTET_STRING_specifics_t *specs = td->specifics
 		? (asn_OCTET_STRING_specifics_t *)td->specifics
-		: &asn_DEF_OCTET_STRING_specs;
+		: &asn_SPC_OCTET_STRING_specs;
 	asn_per_constraints_t *pc = constraints ? constraints
 				: td->per_constraints;
 	asn_per_constraint_t *cval;
@@ -1721,7 +1721,7 @@
 
 	specs = td->specifics
 		    ? (asn_OCTET_STRING_specifics_t *)td->specifics
-		    : &asn_DEF_OCTET_STRING_specs;
+		    : &asn_SPC_OCTET_STRING_specs;
 	ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset);
 
 	ASN_DEBUG("Freeing %s as OCTET STRING", td->name);
@@ -1793,7 +1793,7 @@
 OCTET_STRING_new_fromBuf(asn_TYPE_descriptor_t *td, const char *str, int len) {
 	asn_OCTET_STRING_specifics_t *specs = td->specifics
 				? (asn_OCTET_STRING_specifics_t *)td->specifics
-				: &asn_DEF_OCTET_STRING_specs;
+				: &asn_SPC_OCTET_STRING_specs;
 	OCTET_STRING_t *st;
 
 	st = (OCTET_STRING_t *)CALLOC(1, specs->struct_size);
diff --git a/skeletons/UniversalString.c b/skeletons/UniversalString.c
index 21753eb..6e9d0c3 100644
--- a/skeletons/UniversalString.c
+++ b/skeletons/UniversalString.c
@@ -13,7 +13,7 @@
 	(ASN_TAG_CLASS_UNIVERSAL | (28 << 2)),	/* [UNIVERSAL 28] IMPLICIT ...*/
 	(ASN_TAG_CLASS_UNIVERSAL | (4 << 2))	/* ... OCTET STRING */
 };
-static asn_OCTET_STRING_specifics_t asn_DEF_UniversalString_specs = {
+static asn_OCTET_STRING_specifics_t asn_SPC_UniversalString_specs = {
 	sizeof(UniversalString_t),
 	offsetof(UniversalString_t, _asn_ctx),
 	ASN_OSUBV_U32	/* 32-bits character */
@@ -44,7 +44,7 @@
 	  / sizeof(asn_DEF_UniversalString_tags[0]),
 	&asn_DEF_UniversalString_constraints,
 	0, 0,	/* No members */
-	&asn_DEF_UniversalString_specs
+	&asn_SPC_UniversalString_specs
 };
 
 
diff --git a/tests/125-bitstring-constraint-OK.asn1.-X b/tests/125-bitstring-constraint-OK.asn1.-X
index b33fecc..534182a 100644
--- a/tests/125-bitstring-constraint-OK.asn1.-X
+++ b/tests/125-bitstring-constraint-OK.asn1.-X
@@ -1,4 +1,4 @@
-<!-- XML DTD generated by asn1c-0.9.28 -->
+<!-- XML DTD generated by asn1c-0.9.29 -->
 
 <!-- ASN.1 module
 ModuleBitStringConstraint { iso org(3) dod(6) internet(1) private(4)