Skip to content
Snippets Groups Projects
Commit 4c45e28e authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Cleanup of e->typedefs.

Added check that types are registered before encoding them.
parent 62663201
No related branches found
No related tags found
No related merge requests found
...@@ -98,6 +98,7 @@ void labcomm_encoder_free(struct labcomm_encoder* e) ...@@ -98,6 +98,7 @@ void labcomm_encoder_free(struct labcomm_encoder* e)
labcomm_writer_free(e->writer, e->writer->action_context); labcomm_writer_free(e->writer, e->writer->action_context);
LABCOMM_SIGNATURE_ARRAY_FREE(e->memory, e->registered, int); LABCOMM_SIGNATURE_ARRAY_FREE(e->memory, e->registered, int);
LABCOMM_SIGNATURE_ARRAY_FREE(e->memory, e->sample_ref, int); LABCOMM_SIGNATURE_ARRAY_FREE(e->memory, e->sample_ref, int);
LABCOMM_SIGNATURE_ARRAY_FREE(e->memory, e->typedefs, int);
labcomm_memory_free(memory, 0, e); labcomm_memory_free(memory, 0, e);
} }
//================ //================
...@@ -407,6 +408,10 @@ int labcomm_internal_encode( ...@@ -407,6 +408,10 @@ int labcomm_internal_encode(
index = labcomm_get_local_index(signature); index = labcomm_get_local_index(signature);
length = (signature->encoded_size(value)); length = (signature->encoded_size(value));
labcomm_scheduler_writer_lock(e->scheduler); labcomm_scheduler_writer_lock(e->scheduler);
if (! LABCOMM_SIGNATURE_ARRAY_GET(e->registered, int, index, 0)) {
result = -EINVAL;
goto no_end;
}
result = labcomm_writer_start(e->writer, e->writer->action_context, result = labcomm_writer_start(e->writer, e->writer->action_context,
index, signature, value); index, signature, value);
if (result == -EALREADY) { result = 0; goto no_end; } if (result == -EALREADY) { result = 0; goto no_end; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment