Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
FORMUS3IC_LAS3
/
embb
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f1752cf2
authored
Feb 23, 2016
by
Marcus Winter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
base_c: fixed codesonar warnings
parent
b1c431ae
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
base_c/src/thread.c
+5
-0
base_c/test/alloc_test.cc
+12
-0
No files found.
base_c/src/thread.c
View file @
f1752cf2
...
...
@@ -236,6 +236,11 @@ int embb_thread_create(embb_thread_t* thread, const embb_core_set_t* core_set,
/* Dynamic allocation of thread arguments. Freed on call of join. */
thread
->
embb_internal_arg
=
(
embb_internal_thread_arg_t
*
)
embb_alloc
(
sizeof
(
embb_internal_thread_arg_t
));
if
(
thread
->
embb_internal_arg
==
NULL
)
{
thread
->
embb_internal_handle
=
NULL
;
pthread_attr_destroy
(
&
attr
);
return
EMBB_NOMEM
;
}
thread
->
embb_internal_arg
->
func
=
func
;
thread
->
embb_internal_arg
->
arg
=
arg
;
...
...
base_c/test/alloc_test.cc
View file @
f1752cf2
...
...
@@ -152,6 +152,9 @@ void AllocTest::TestMixedAllocs() {
void
*
plain
=
NULL
;
plain
=
embb_alloc
(
2
);
PT_EXPECT_NE
(
plain
,
static_cast
<
void
*>
(
NULL
));
if
(
NULL
==
plain
)
{
return
;
}
allocated
=
embb_get_bytes_allocated
();
#ifdef EMBB_DEBUG
expected
+=
2
+
2
*
sizeof
(
size_t
);
...
...
@@ -162,6 +165,10 @@ void AllocTest::TestMixedAllocs() {
void
*
aligned
=
NULL
;
aligned
=
embb_alloc_aligned
(
2
*
sizeof
(
void
*
),
2
);
PT_EXPECT_NE
(
aligned
,
static_cast
<
void
*>
(
NULL
));
if
(
NULL
==
aligned
)
{
embb_free
(
plain
);
return
;
}
allocated
=
embb_get_bytes_allocated
();
#ifdef EMBB_DEBUG
expected
+=
(
1
+
1
)
*
2
*
sizeof
(
void
*
)
+
3
*
sizeof
(
size_t
)
-
1
;
...
...
@@ -172,6 +179,11 @@ void AllocTest::TestMixedAllocs() {
void
*
cache_aligned
=
NULL
;
cache_aligned
=
embb_alloc_cache_aligned
(
2
);
PT_EXPECT_NE
(
cache_aligned
,
static_cast
<
void
*>
(
NULL
));
if
(
NULL
==
aligned
)
{
embb_free
(
plain
);
embb_free_aligned
(
aligned
);
return
;
}
allocated
=
embb_get_bytes_allocated
();
#ifdef EMBB_DEBUG
expected
+=
(
1
+
1
)
*
EMBB_PLATFORM_CACHE_LINE_SIZE
+
3
*
sizeof
(
size_t
)
-
1
;
...
...
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