Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
LabComm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Anders Blomdell
LabComm
Commits
4db2a65b
Commit
4db2a65b
authored
9 years ago
by
Anders Blomdell
Browse files
Options
Downloads
Patches
Plain Diff
Fixed return of reference to possibly moving memory.
parent
beb0b091
Loading
Loading
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/c/2014/labcomm2014_decoder.c
+14
-11
14 additions, 11 deletions
lib/c/2014/labcomm2014_decoder.c
lib/c/2014/labcomm2014_renaming_decoder.c
+2
-2
2 additions, 2 deletions
lib/c/2014/labcomm2014_renaming_decoder.c
test/Makefile
+4
-2
4 additions, 2 deletions
test/Makefile
with
20 additions
and
15 deletions
lib/c/2014/labcomm2014_decoder.c
+
14
−
11
View file @
4db2a65b
...
...
@@ -265,23 +265,26 @@ out:
}
static
labcomm2014_decoder_function
lookup_h
(
struct
labcomm2014_decoder
*
d
,
struct
call_handler_context
*
wrap
,
int
remote_index
,
int
*
*
local_index
)
struct
call_handler_context
*
wrap
,
int
remote_index
,
int
*
r_
local_index
)
{
struct
decoder
*
id
=
d
->
context
;
labcomm2014_decoder_function
do_decode
=
NULL
;
int
*
local_index
;
labcomm2014_scheduler_data_lock
(
d
->
scheduler
);
*
local_index
=
LABCOMM_SIGNATURE_ARRAY_REF
(
d
->
memory
,
id
->
remote_to_local
,
int
,
remote_index
);
if
(
**
local_index
!=
0
)
{
local_index
=
LABCOMM_SIGNATURE_ARRAY_REF
(
d
->
memory
,
id
->
remote_to_local
,
int
,
remote_index
);
*
r_local_index
=
*
local_index
;
if
(
*
local_index
!=
0
)
{
struct
sample_entry
*
entry
;
entry
=
LABCOMM_SIGNATURE_ARRAY_REF
(
d
->
memory
,
id
->
local
,
struct
sample_entry
,
*
*
local_index
);
wrap
->
local_index
=
*
*
local_index
;
*
local_index
);
wrap
->
local_index
=
*
local_index
;
wrap
->
signature
=
entry
->
signature
;
wrap
->
handler
=
entry
->
handler
;
wrap
->
context
=
entry
->
context
;
...
...
@@ -300,7 +303,7 @@ static int decode_and_handle(struct labcomm2014_decoder *d,
int
remote_index
)
{
int
result
;
int
*
local_index
;
int
local_index
;
struct
call_handler_context
wrap
=
{
.
reader
=
d
->
reader
,
.
remote_index
=
remote_index
,
...
...
@@ -309,7 +312,7 @@ static int decode_and_handle(struct labcomm2014_decoder *d,
.
context
=
NULL
,
};
labcomm2014_decoder_function
do_decode
=
lookup_h
(
registry
,
&
wrap
,
remote_index
,
&
local_index
);
result
=
*
local_index
;
result
=
local_index
;
if
(
do_decode
)
{
do_decode
(
d
->
reader
,
call_handler
,
&
wrap
);
if
(
d
->
reader
->
error
<
0
)
{
...
...
This diff is collapsed.
Click to expand it.
lib/c/2014/labcomm2014_renaming_decoder.c
+
2
−
2
View file @
4db2a65b
...
...
@@ -168,8 +168,8 @@ static const struct labcomm2014_sample_ref *do_ref_get(
{
const
struct
labcomm2014_signature
*
renamed
;
struct
decoder
*
id
=
d
->
context
;
renamed
=
get_renamed
(
d
,
signature
);
renamed
=
get_renamed
(
d
,
signature
);
if
(
renamed
==
NULL
)
{
return
id
->
next
->
ref_get
(
id
->
next
,
signature
);
}
else
{
...
...
This diff is collapsed.
Click to expand it.
test/Makefile
+
4
−
2
View file @
4db2a65b
TESTS
=
basic simple nested ref
TESTS_RENAME
=
basic simple nested
# sample_ref's does not transfer between
# encoder decoder for now
TESTS
=
$(
TESTS_RENAME
)
ref
LABCOMM_JAR
=
../compiler/labcomm2014_compiler.jar
LABCOMM
=
java
-jar
$(
LABCOMM_JAR
)
MONO_PATH
=
$(
shell
pwd
)
/../lib/csharp
...
...
@@ -8,7 +10,7 @@ include ../lib/c/os_compat.mk
all
:
test
:
$(TESTS:%=test_%) $(TESTS:%=test_renaming_%) compiler_errors
test
:
$(TESTS:%=test_%) $(TESTS
_RENAME
:%=test_renaming_%) compiler_errors
# PYTHONPATH=../lib/python \
# ./test_encoder_decoder.py --labcomm="$(LABCOMM)" basic.lc
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment