removed needless SML_SKIP_OPTIONAL

This commit is contained in:
Juri Glass 2011-09-29 18:32:36 +02:00
parent b2e5377b35
commit e85407a2bc
2 changed files with 10 additions and 12 deletions

View file

@ -106,7 +106,6 @@ void sml_buf_update_bytes_read(sml_buffer *buf, int bytes);
// Checks if the next field is a skipped optional field, updates the buffer accordingly
int sml_buf_optional_is_skipped(sml_buffer *buf);
#define SML_SKIP_OPTIONAL (sml_buf_optional_is_skipped(buf)) ? 0 :
void hexdump(unsigned char *buffer, size_t buffer_len);

View file

@ -101,8 +101,6 @@ void sml_list_add(sml_list *list, sml_list *new_entry) {
list->next = new_entry;
}
// This function doesn't free the allocated memory in error cases,
// this is done in sml_list_parse.
sml_list *sml_list_entry_parse(sml_buffer *buf) {
if (sml_buf_get_next_type(buf) != SML_TYPE_LIST) {
buf->error = 1;
@ -117,19 +115,19 @@ sml_list *sml_list_entry_parse(sml_buffer *buf) {
l->obj_name = sml_octet_string_parse(buf);
if (sml_buf_has_errors(buf)) goto error;
l->status = sml_status_parse(buf);
if (sml_buf_has_errors(buf)) goto error;
l->val_time = SML_SKIP_OPTIONAL sml_time_parse(buf);
l->val_time = sml_time_parse(buf);
if (sml_buf_has_errors(buf)) goto error;
l->unit = sml_u8_parse(buf);
if (sml_buf_has_errors(buf)) goto error;
l->scaler = sml_i8_parse(buf);
if (sml_buf_has_errors(buf)) goto error;
l->value = sml_value_parse(buf);
if (sml_buf_has_errors(buf)) goto error;
@ -138,10 +136,11 @@ sml_list *sml_list_entry_parse(sml_buffer *buf) {
return l;
error:
printf("error\n");
buf->error = 1;
return 0;
error:
// This function doesn't free the allocated memory in error cases,
// this is done in sml_list_parse.
buf->error = 1;
return 0;
}
sml_list *sml_list_parse(sml_buffer *buf) {