Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asn1c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
asn1c
Commits
adcb586c
Commit
adcb586c
authored
Mar 17, 2006
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macro for free_struct()
parent
8253ea93
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
19 additions
and
17 deletions
+19
-17
skeletons/ANY.c
skeletons/ANY.c
+1
-1
skeletons/GeneralizedTime.c
skeletons/GeneralizedTime.c
+1
-2
skeletons/NativeInteger.c
skeletons/NativeInteger.c
+2
-2
skeletons/NativeReal.c
skeletons/NativeReal.c
+2
-2
skeletons/asn-decoder-template.c
skeletons/asn-decoder-template.c
+2
-2
skeletons/constr_CHOICE.c
skeletons/constr_CHOICE.c
+2
-2
skeletons/constr_SEQUENCE.c
skeletons/constr_SEQUENCE.c
+2
-2
skeletons/constr_SET.c
skeletons/constr_SET.c
+2
-2
skeletons/constr_SET_OF.c
skeletons/constr_SET_OF.c
+2
-2
skeletons/constr_TYPE.h
skeletons/constr_TYPE.h
+3
-0
No files found.
skeletons/ANY.c
View file @
adcb586c
...
@@ -133,7 +133,7 @@ ANY_to_type(ANY_t *st, asn_TYPE_descriptor_t *td, void **struct_ptr) {
...
@@ -133,7 +133,7 @@ ANY_to_type(ANY_t *st, asn_TYPE_descriptor_t *td, void **struct_ptr) {
return
0
;
return
0
;
}
else
{
}
else
{
/* Remove possibly partially decoded data. */
/* Remove possibly partially decoded data. */
td
->
free_struct
(
td
,
newst
,
0
);
ASN_STRUCT_FREE
(
*
td
,
newst
);
return
-
1
;
return
-
1
;
}
}
}
}
...
...
skeletons/GeneralizedTime.c
View file @
adcb586c
...
@@ -218,8 +218,7 @@ GeneralizedTime_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
...
@@ -218,8 +218,7 @@ GeneralizedTime_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
rv
=
OCTET_STRING_encode_xer_utf8
(
td
,
sptr
,
ilevel
,
flags
,
rv
=
OCTET_STRING_encode_xer_utf8
(
td
,
sptr
,
ilevel
,
flags
,
cb
,
app_key
);
cb
,
app_key
);
asn_DEF_GeneralizedTime
.
free_struct
(
&
asn_DEF_GeneralizedTime
,
ASN_STRUCT_FREE
(
asn_DEF_GeneralizedTime
,
gt
);
gt
,
0
);
return
rv
;
return
rv
;
}
else
{
}
else
{
return
OCTET_STRING_encode_xer_utf8
(
td
,
sptr
,
ilevel
,
flags
,
return
OCTET_STRING_encode_xer_utf8
(
td
,
sptr
,
ilevel
,
flags
,
...
...
skeletons/NativeInteger.c
View file @
adcb586c
...
@@ -194,7 +194,7 @@ NativeInteger_decode_xer(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -194,7 +194,7 @@ NativeInteger_decode_xer(asn_codec_ctx_t *opt_codec_ctx,
*/
*/
rval
.
consumed
=
0
;
rval
.
consumed
=
0
;
}
}
asn_DEF_INTEGER
.
free_struct
(
&
asn_DEF_INTEGER
,
&
st
,
1
);
ASN_STRUCT_FREE_CONTENTS_ONLY
(
asn_DEF_INTEGER
,
&
st
);
return
rval
;
return
rval
;
}
}
...
@@ -248,7 +248,7 @@ NativeInteger_decode_uper(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -248,7 +248,7 @@ NativeInteger_decode_uper(asn_codec_ctx_t *opt_codec_ctx,
ASN_DEBUG
(
"NativeInteger %s got value %ld"
,
ASN_DEBUG
(
"NativeInteger %s got value %ld"
,
td
->
name
,
*
native
);
td
->
name
,
*
native
);
}
}
asn_DEF_INTEGER
.
free_struct
(
&
asn_DEF_INTEGER
,
&
tmpint
,
1
);
ASN_STRUCT_FREE_CONTENTS_ONLY
(
asn_DEF_INTEGER
,
&
tmpint
);
return
rval
;
return
rval
;
}
}
...
...
skeletons/NativeReal.c
View file @
adcb586c
...
@@ -152,7 +152,7 @@ NativeReal_encode_der(asn_TYPE_descriptor_t *td, void *ptr,
...
@@ -152,7 +152,7 @@ NativeReal_encode_der(asn_TYPE_descriptor_t *td, void *ptr,
}
}
/* Free possibly allocated members of the temporary structure */
/* Free possibly allocated members of the temporary structure */
asn_DEF_REAL
.
free_struct
(
&
asn_DEF_REAL
,
&
tmp
,
1
);
ASN_STRUCT_FREE_CONTENTS_ONLY
(
asn_DEF_REAL
,
&
tmp
);
return
erval
;
return
erval
;
}
}
...
@@ -190,7 +190,7 @@ NativeReal_decode_xer(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -190,7 +190,7 @@ NativeReal_decode_xer(asn_codec_ctx_t *opt_codec_ctx,
}
else
{
}
else
{
rval
.
consumed
=
0
;
rval
.
consumed
=
0
;
}
}
asn_DEF_REAL
.
free_struct
(
&
asn_DEF_REAL
,
st
,
0
);
ASN_STRUCT_FREE
(
asn_DEF_REAL
,
st
);
return
rval
;
return
rval
;
}
}
...
...
skeletons/asn-decoder-template.c
View file @
adcb586c
...
@@ -244,7 +244,7 @@ main(int ac, char **av) {
...
@@ -244,7 +244,7 @@ main(int ac, char **av) {
break
;
break
;
}
}
pduType
->
free_struct
(
pduType
,
structure
,
0
);
ASN_STRUCT_FREE
(
*
pduType
,
structure
);
}
}
}
}
...
@@ -425,7 +425,7 @@ static void *data_decode_from_file(asn_TYPE_descriptor_t *pduType, const char *f
...
@@ -425,7 +425,7 @@ static void *data_decode_from_file(asn_TYPE_descriptor_t *pduType, const char *f
fclose
(
fp
);
fclose
(
fp
);
/* Clean up partially decoded structure */
/* Clean up partially decoded structure */
pduType
->
free_struct
(
pduType
,
structure
,
0
);
ASN_STRUCT_FREE
(
*
pduType
,
structure
);
fprintf
(
stderr
,
"%s: "
fprintf
(
stderr
,
"%s: "
"Decode failed past byte %ld: %s
\n
"
,
"Decode failed past byte %ld: %s
\n
"
,
...
...
skeletons/constr_CHOICE.c
View file @
adcb586c
...
@@ -959,10 +959,10 @@ CHOICE_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) {
...
@@ -959,10 +959,10 @@ CHOICE_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) {
if
(
elm
->
flags
&
ATF_POINTER
)
{
if
(
elm
->
flags
&
ATF_POINTER
)
{
memb_ptr
=
*
(
void
**
)((
char
*
)
ptr
+
elm
->
memb_offset
);
memb_ptr
=
*
(
void
**
)((
char
*
)
ptr
+
elm
->
memb_offset
);
if
(
memb_ptr
)
if
(
memb_ptr
)
elm
->
type
->
free_struct
(
elm
->
type
,
memb_ptr
,
0
);
ASN_STRUCT_FREE
(
*
elm
->
type
,
memb_ptr
);
}
else
{
}
else
{
memb_ptr
=
(
void
*
)((
char
*
)
ptr
+
elm
->
memb_offset
);
memb_ptr
=
(
void
*
)((
char
*
)
ptr
+
elm
->
memb_offset
);
elm
->
type
->
free_struct
(
elm
->
type
,
memb_ptr
,
1
);
ASN_STRUCT_FREE_CONTENTS_ONLY
(
*
elm
->
type
,
memb_ptr
);
}
}
}
}
...
...
skeletons/constr_SEQUENCE.c
View file @
adcb586c
...
@@ -958,10 +958,10 @@ SEQUENCE_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) {
...
@@ -958,10 +958,10 @@ SEQUENCE_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) {
if
(
elm
->
flags
&
ATF_POINTER
)
{
if
(
elm
->
flags
&
ATF_POINTER
)
{
memb_ptr
=
*
(
void
**
)((
char
*
)
sptr
+
elm
->
memb_offset
);
memb_ptr
=
*
(
void
**
)((
char
*
)
sptr
+
elm
->
memb_offset
);
if
(
memb_ptr
)
if
(
memb_ptr
)
elm
->
type
->
free_struct
(
elm
->
type
,
memb_ptr
,
0
);
ASN_STRUCT_FREE
(
*
elm
->
type
,
memb_ptr
);
}
else
{
}
else
{
memb_ptr
=
(
void
*
)((
char
*
)
sptr
+
elm
->
memb_offset
);
memb_ptr
=
(
void
*
)((
char
*
)
sptr
+
elm
->
memb_offset
);
elm
->
type
->
free_struct
(
elm
->
type
,
memb_ptr
,
1
);
ASN_STRUCT_FREE_CONTENTS_ONLY
(
*
elm
->
type
,
memb_ptr
);
}
}
}
}
...
...
skeletons/constr_SET.c
View file @
adcb586c
...
@@ -924,10 +924,10 @@ SET_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) {
...
@@ -924,10 +924,10 @@ SET_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) {
if
(
elm
->
flags
&
ATF_POINTER
)
{
if
(
elm
->
flags
&
ATF_POINTER
)
{
memb_ptr
=
*
(
void
**
)((
char
*
)
ptr
+
elm
->
memb_offset
);
memb_ptr
=
*
(
void
**
)((
char
*
)
ptr
+
elm
->
memb_offset
);
if
(
memb_ptr
)
if
(
memb_ptr
)
elm
->
type
->
free_struct
(
elm
->
type
,
memb_ptr
,
0
);
ASN_STRUCT_FREE
(
*
elm
->
type
,
memb_ptr
);
}
else
{
}
else
{
memb_ptr
=
(
void
*
)((
char
*
)
ptr
+
elm
->
memb_offset
);
memb_ptr
=
(
void
*
)((
char
*
)
ptr
+
elm
->
memb_offset
);
elm
->
type
->
free_struct
(
elm
->
type
,
memb_ptr
,
1
);
ASN_STRUCT_FREE_CONTENTS_ONLY
(
*
elm
->
type
,
memb_ptr
);
}
}
}
}
...
...
skeletons/constr_SET_OF.c
View file @
adcb586c
...
@@ -798,7 +798,7 @@ SET_OF_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) {
...
@@ -798,7 +798,7 @@ SET_OF_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) {
for
(
i
=
0
;
i
<
list
->
count
;
i
++
)
{
for
(
i
=
0
;
i
<
list
->
count
;
i
++
)
{
void
*
memb_ptr
=
list
->
array
[
i
];
void
*
memb_ptr
=
list
->
array
[
i
];
if
(
memb_ptr
)
if
(
memb_ptr
)
elm
->
type
->
free_struct
(
elm
->
type
,
memb_ptr
,
0
);
ASN_STRUCT_FREE
(
*
elm
->
type
,
memb_ptr
);
}
}
list
->
count
=
0
;
/* No meaningful elements left */
list
->
count
=
0
;
/* No meaningful elements left */
...
@@ -925,7 +925,7 @@ SET_OF_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
...
@@ -925,7 +925,7 @@ SET_OF_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
ASN_DEBUG
(
"Failed decoding %s of %s (SET OF)"
,
ASN_DEBUG
(
"Failed decoding %s of %s (SET OF)"
,
elm
->
type
->
name
,
td
->
name
);
elm
->
type
->
name
,
td
->
name
);
}
}
if
(
ptr
)
elm
->
type
->
free_struct
(
elm
->
type
,
ptr
,
0
);
if
(
ptr
)
ASN_STRUCT_FREE
(
*
elm
->
type
,
ptr
);
_ASN_DECODE_FAILED
;
_ASN_DECODE_FAILED
;
}
}
...
...
skeletons/constr_TYPE.h
View file @
adcb586c
...
@@ -52,6 +52,9 @@ typedef struct asn_struct_ctx_s {
...
@@ -52,6 +52,9 @@ typedef struct asn_struct_ctx_s {
typedef
void
(
asn_struct_free_f
)(
typedef
void
(
asn_struct_free_f
)(
struct
asn_TYPE_descriptor_s
*
type_descriptor
,
struct
asn_TYPE_descriptor_s
*
type_descriptor
,
void
*
struct_ptr
,
int
free_contents_only
);
void
*
struct_ptr
,
int
free_contents_only
);
#define ASN_STRUCT_FREE(asn_DEF, ptr) (asn_DEF).free_struct(&(asn_DEF),ptr,0)
#define ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF, ptr) \
(asn_DEF).free_struct(&(asn_DEF),ptr,1)
/*
/*
* Print the structure according to its specification.
* Print the structure according to its specification.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment