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
47fc74ca
Commit
47fc74ca
authored
Sep 26, 2017
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
proper destruction of a name storage
parent
ef8dd441
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
0 deletions
+27
-0
libasn1compiler/asn1c_naming.c
libasn1compiler/asn1c_naming.c
+23
-0
libasn1compiler/asn1c_naming.h
libasn1compiler/asn1c_naming.h
+2
-0
libasn1compiler/asn1compiler.c
libasn1compiler/asn1compiler.c
+2
-0
No files found.
libasn1compiler/asn1c_naming.c
View file @
47fc74ca
...
...
@@ -17,6 +17,24 @@ c_name_clash_finder_init() {
TQ_INIT
(
&
used_names
);
}
void
c_name_clash_finder_destroy
()
{
struct
intl_name
*
n
;
while
((
n
=
TQ_REMOVE
(
&
used_names
,
next
)))
{
union
{
const
char
*
c_buf
;
char
*
nc_buf
;
}
const_cast
;
asn1p_expr_free
(
n
->
expr
);
asn1p_expr_free
(
n
->
clashes_with
);
const_cast
.
c_buf
=
n
->
name
;
free
(
const_cast
.
nc_buf
);
free
(
n
);
}
}
static
void
register_global_name
(
arg_t
*
arg
,
const
char
*
name
)
{
struct
intl_name
*
n
;
...
...
@@ -25,14 +43,19 @@ register_global_name(arg_t *arg, const char *name) {
if
(
strcmp
(
n
->
name
,
name
)
==
0
)
{
if
(
!
(
arg
->
expr
->
_mark
&
TM_NAMEGIVEN
)
&&
arg
->
expr
!=
n
->
expr
)
{
n
->
clashes_with
=
arg
->
expr
;
arg
->
expr
->
ref_cnt
++
;
return
;
}
}
}
if
(
arg
->
expr
->
_mark
&
TM_NAMEGIVEN
)
return
;
n
=
calloc
(
1
,
sizeof
(
*
n
));
assert
(
n
);
n
->
expr
=
arg
->
expr
;
arg
->
expr
->
ref_cnt
++
;
n
->
name
=
strdup
(
name
);
TQ_ADD
(
&
used_names
,
n
,
next
);
}
...
...
libasn1compiler/asn1c_naming.h
View file @
47fc74ca
...
...
@@ -25,4 +25,6 @@ int c_name_clash(arg_t *arg);
void
c_name_clash_finder_init
(
void
);
void
c_name_clash_finder_destroy
(
void
);
#endif
/* ASN1_COMPILER_NAMING_H */
libasn1compiler/asn1compiler.c
View file @
47fc74ca
...
...
@@ -79,6 +79,8 @@ asn1_compile(asn1p_t *asn, const char *datadir, enum asn1c_flags flags,
DEBUG
(
"Saving compiled data"
);
c_name_clash_finder_destroy
();
/*
* Save or print out the compiled result.
*/
...
...
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