Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abc
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
abc
Commits
dccd3992
Commit
dccd3992
authored
Jan 11, 2020
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding dynamic memory alloc for the buffer in Liberty file reader.
parent
1bb50384
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
src/map/scl/sclLiberty.c
+9
-3
No files found.
src/map/scl/sclLiberty.c
View file @
dccd3992
...
@@ -29,7 +29,7 @@ ABC_NAMESPACE_IMPL_START
...
@@ -29,7 +29,7 @@ ABC_NAMESPACE_IMPL_START
/// DECLARATIONS ///
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
#define ABC_MAX_LIB_STR_LEN 5000
//
#define ABC_MAX_LIB_STR_LEN 5000
// entry types
// entry types
typedef
enum
{
typedef
enum
{
...
@@ -70,6 +70,7 @@ struct Scl_Tree_t_
...
@@ -70,6 +70,7 @@ struct Scl_Tree_t_
Scl_Item_t
*
pItems
;
// the items
Scl_Item_t
*
pItems
;
// the items
char
*
pError
;
// the error string
char
*
pError
;
// the error string
abctime
clkStart
;
// beginning time
abctime
clkStart
;
// beginning time
Vec_Str_t
*
vBuffer
;
// temp string buffer
};
};
static
inline
Scl_Item_t
*
Scl_LibertyRoot
(
Scl_Tree_t
*
p
)
{
return
p
->
pItems
;
}
static
inline
Scl_Item_t
*
Scl_LibertyRoot
(
Scl_Tree_t
*
p
)
{
return
p
->
pItems
;
}
...
@@ -340,8 +341,11 @@ static inline Scl_Item_t * Scl_LibertyNewItem( Scl_Tree_t * p, int Type )
...
@@ -340,8 +341,11 @@ static inline Scl_Item_t * Scl_LibertyNewItem( Scl_Tree_t * p, int Type )
***********************************************************************/
***********************************************************************/
char
*
Scl_LibertyReadString
(
Scl_Tree_t
*
p
,
Scl_Pair_t
Pair
)
char
*
Scl_LibertyReadString
(
Scl_Tree_t
*
p
,
Scl_Pair_t
Pair
)
{
{
static
char
Buffer
[
ABC_MAX_LIB_STR_LEN
];
// static char Buffer[ABC_MAX_LIB_STR_LEN];
assert
(
Pair
.
End
-
Pair
.
Beg
<
ABC_MAX_LIB_STR_LEN
);
char
*
Buffer
;
if
(
Pair
.
End
-
Pair
.
Beg
+
2
>
Vec_StrSize
(
p
->
vBuffer
)
)
Vec_StrFill
(
p
->
vBuffer
,
Pair
.
End
-
Pair
.
Beg
+
100
,
'\0'
);
Buffer
=
Vec_StrArray
(
p
->
vBuffer
);
strncpy
(
Buffer
,
p
->
pContents
+
Pair
.
Beg
,
Pair
.
End
-
Pair
.
Beg
);
strncpy
(
Buffer
,
p
->
pContents
+
Pair
.
Beg
,
Pair
.
End
-
Pair
.
Beg
);
if
(
Pair
.
Beg
<
Pair
.
End
&&
Buffer
[
0
]
==
'\"'
)
if
(
Pair
.
Beg
<
Pair
.
End
&&
Buffer
[
0
]
==
'\"'
)
{
{
...
@@ -572,6 +576,7 @@ Scl_Tree_t * Scl_LibertyStart( char * pFileName )
...
@@ -572,6 +576,7 @@ Scl_Tree_t * Scl_LibertyStart( char * pFileName )
p
->
pItems
=
ABC_CALLOC
(
Scl_Item_t
,
p
->
nItermAlloc
);
p
->
pItems
=
ABC_CALLOC
(
Scl_Item_t
,
p
->
nItermAlloc
);
p
->
nItems
=
0
;
p
->
nItems
=
0
;
p
->
nLines
=
1
;
p
->
nLines
=
1
;
p
->
vBuffer
=
Vec_StrStart
(
10
);
return
p
;
return
p
;
}
}
void
Scl_LibertyStop
(
Scl_Tree_t
*
p
,
int
fVerbose
)
void
Scl_LibertyStop
(
Scl_Tree_t
*
p
,
int
fVerbose
)
...
@@ -581,6 +586,7 @@ void Scl_LibertyStop( Scl_Tree_t * p, int fVerbose )
...
@@ -581,6 +586,7 @@ void Scl_LibertyStop( Scl_Tree_t * p, int fVerbose )
printf
(
"Memory = %7.2f MB. "
,
1
.
0
*
(
p
->
nContents
+
p
->
nItermAlloc
*
sizeof
(
Scl_Item_t
))
/
(
1
<<
20
)
);
printf
(
"Memory = %7.2f MB. "
,
1
.
0
*
(
p
->
nContents
+
p
->
nItermAlloc
*
sizeof
(
Scl_Item_t
))
/
(
1
<<
20
)
);
ABC_PRT
(
"Time"
,
Abc_Clock
()
-
p
->
clkStart
);
ABC_PRT
(
"Time"
,
Abc_Clock
()
-
p
->
clkStart
);
}
}
Vec_StrFree
(
p
->
vBuffer
);
ABC_FREE
(
p
->
pFileName
);
ABC_FREE
(
p
->
pFileName
);
ABC_FREE
(
p
->
pContents
);
ABC_FREE
(
p
->
pContents
);
ABC_FREE
(
p
->
pItems
);
ABC_FREE
(
p
->
pItems
);
...
...
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