Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Anders Blomdell
LabComm
Commits
4db2a65b
Commit
4db2a65b
authored
May 25, 2015
by
Anders Blomdell
Browse files
Fixed return of reference to possibly moving memory.
parent
beb0b091
Changes
3
Hide whitespace changes
Inline
Side-by-side
lib/c/2014/labcomm2014_decoder.c
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
)
{
...
...
lib/c/2014/labcomm2014_renaming_decoder.c
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
{
...
...
test/Makefile
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
...
...
Write
Preview
Supports
Markdown
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