diff --git a/compiler2/record.c b/compiler2/record.c index b6bfc12077c9e1329419f575dfb5f581ba5b0a85..5bd9b97247140c9393aa4e43d7443d70eafa2725 100644 --- a/compiler2/record.c +++ b/compiler2/record.c @@ -3242,7 +3242,7 @@ char* generate_json_decoder(char* src, const struct_def* sdef) if (sdef->nElements == 1) { if (!sdef->jsonAsValue) { - src = mputstr(src, " if (NULL != p_td.json && p_td.json->as_value) {\n"); + src = mputstr(src, " if (p_td.json->as_value) {\n"); } if (sdef->elements[0].isOptional) { // can only happen if the record has the 'JSON:object' attribute; @@ -4808,7 +4808,7 @@ void defRecordClass1(const struct_def *sdef, output_struct *output) ((sdef->nElements == 1 && !sdef->jsonAsValue) || sdef->jsonAsMapPossible) ? " p_td" : "", dispname); if (sdef->nElements == 1) { if (!sdef->jsonAsValue) { - src = mputstr(src, " if (NULL != p_td.json && p_td.json->as_value) {\n"); + src = mputstr(src, " if (p_td.json->as_value) {\n"); } if (sdef->elements[0].isOptional) { // can only happen if the record has the 'JSON:object' attribute; diff --git a/compiler2/record_of.c b/compiler2/record_of.c index 64add1207f2833ee298d55a3ad4b7199a942e9c7..61b4d18956528504ededa714a0c8d1ae0a122b6a 100644 --- a/compiler2/record_of.c +++ b/compiler2/record_of.c @@ -1548,7 +1548,7 @@ void defRecordOfClass1(const struct_of_def *sdef, output_struct *output) " int enc_len = p_tok.put_next_token(p_td.json->as_map ? " "JSON_TOKEN_OBJECT_START : JSON_TOKEN_ARRAY_START, NULL);\n" " for (int i = 0; i < val_ptr->n_elements; ++i) {\n" - " if (NULL != p_td.json && p_td.json->metainfo_unbound && !(*this)[i].is_bound()) {\n" + " if (p_td.json->metainfo_unbound && !(*this)[i].is_bound()) {\n" // unbound elements are encoded as { "metainfo []" : "unbound" } " enc_len += p_tok.put_next_token(JSON_TOKEN_OBJECT_START, NULL);\n" " enc_len += p_tok.put_next_token(JSON_TOKEN_NAME, \"metainfo []\");\n" @@ -1591,7 +1591,7 @@ void defRecordOfClass1(const struct_of_def *sdef, output_struct *output) " for (int nof_elements = 0; TRUE; ++nof_elements) {\n" " size_t buf_pos = p_tok.get_buf_pos();\n" " size_t ret_val;\n" - " if (NULL != p_td.json && p_td.json->metainfo_unbound) {\n" + " if (p_td.json->metainfo_unbound) {\n" // check for metainfo object " ret_val = p_tok.get_next_token(&token, NULL, NULL);\n" " if (JSON_TOKEN_OBJECT_START == token) {\n" @@ -3067,7 +3067,7 @@ void defRecordOfClassMemAllocOptimized(const struct_of_def *sdef, output_struct " }\n\n" " int enc_len = p_tok.put_next_token(JSON_TOKEN_ARRAY_START, NULL);\n" " for (int i = 0; i < n_elements; ++i) {\n" - " if (NULL != p_td.json && p_td.json->metainfo_unbound && !value_elements[i].is_bound()) {\n" + " if (p_td.json->metainfo_unbound && !value_elements[i].is_bound()) {\n" // unbound elements are encoded as { "metainfo []" : "unbound" } " enc_len += p_tok.put_next_token(JSON_TOKEN_OBJECT_START, NULL);\n" " enc_len += p_tok.put_next_token(JSON_TOKEN_NAME, \"metainfo []\");\n" @@ -3102,7 +3102,7 @@ void defRecordOfClassMemAllocOptimized(const struct_of_def *sdef, output_struct " for (int nof_elements = 0; TRUE; ++nof_elements) {\n" " size_t buf_pos = p_tok.get_buf_pos();\n" " size_t ret_val;\n" - " if (NULL != p_td.json && p_td.json->metainfo_unbound) {\n" + " if (p_td.json->metainfo_unbound) {\n" // check for metainfo object " ret_val = p_tok.get_next_token(&token, NULL, NULL);\n" " if (JSON_TOKEN_OBJECT_START == token) {\n" diff --git a/compiler2/union.c b/compiler2/union.c index 9fff9169b74a437d8b7092e590e521615737e86e..66e03ed7df9aaae84ed93f76a20879483d4acd90 100644 --- a/compiler2/union.c +++ b/compiler2/union.c @@ -2050,7 +2050,7 @@ void defUnionClass(struct_def const *sdef, output_struct *output) // 'as value' is not set for the base type, but it might still be set in // the type descriptor src = mputstr(src, - " boolean as_value = NULL != p_td.json && p_td.json->as_value;\n" + " boolean as_value = p_td.json->as_value;\n" " int enc_len = as_value ? 0 : " "p_tok.put_next_token(JSON_TOKEN_OBJECT_START, NULL);\n"); } else { @@ -2112,7 +2112,7 @@ void defUnionClass(struct_def const *sdef, output_struct *output) // 'as value' is not set for the base type, but it might still be set in // the type descriptor src = mputstr(src, - " boolean as_value = NULL != p_td.json && p_td.json->as_value;\n" + " boolean as_value = p_td.json->as_value;\n" " int enc_len = as_value ? 0 : " "p_tok.put_next_token(JSON_TOKEN_OBJECT_START, NULL);\n"); } else { @@ -2217,7 +2217,7 @@ void defUnionClass(struct_def const *sdef, output_struct *output) " json_token_t j_token = JSON_TOKEN_NONE;\n"); if (!sdef->jsonAsValue) { src = mputstr(src, - " if (NULL != p_td.json && p_td.json->as_value) {\n"); + " if (p_td.json->as_value) {\n"); } src = mputstr(src, " size_t buf_pos = p_tok.get_buf_pos();\n" diff --git a/core/Array.hh b/core/Array.hh index e5980f60de83f5539a81a2a5df380a13ef001387..4a242f2c9734d163e09a4158bf84544c43b20051 100644 --- a/core/Array.hh +++ b/core/Array.hh @@ -1366,7 +1366,7 @@ int VALUE_ARRAY<T_type,array_size,index_offset>::JSON_encode( int enc_len = p_tok.put_next_token(JSON_TOKEN_ARRAY_START, NULL); for (unsigned int i = 0; i < array_size; ++i) { - if (NULL != p_td.json && p_td.json->metainfo_unbound && !array_elements[i].is_bound()) { + if (p_td.json->metainfo_unbound && !array_elements[i].is_bound()) { // unbound elements are encoded as { "metainfo []" : "unbound" } enc_len += p_tok.put_next_token(JSON_TOKEN_OBJECT_START, NULL); enc_len += p_tok.put_next_token(JSON_TOKEN_NAME, "metainfo []"); @@ -1401,7 +1401,7 @@ int VALUE_ARRAY<T_type,array_size,index_offset>::JSON_decode( for (unsigned int i = 0; i < array_size; ++i) { size_t buf_pos = p_tok.get_buf_pos(); size_t ret_val; - if (NULL != p_td.json && p_td.json->metainfo_unbound) { + if (p_td.json->metainfo_unbound) { // check for metainfo object ret_val = p_tok.get_next_token(&token, NULL, NULL); if (JSON_TOKEN_OBJECT_START == token) { diff --git a/core2/Basetype2.cc b/core2/Basetype2.cc index 9f7a4d1937fcd59607ac509bd2e83460145d5c7c..3839dc55cf12d8c3724f01ed3c5408fac9dcbc60 100644 --- a/core2/Basetype2.cc +++ b/core2/Basetype2.cc @@ -1481,7 +1481,7 @@ int Record_Of_Type::JSON_encode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenize JSON_TOKEN_ARRAY_START, NULL); for (int i = 0; i < get_nof_elements(); ++i) { - if (NULL != p_td.json && p_td.json->metainfo_unbound && !get_at(i)->is_bound()) { + if (p_td.json->metainfo_unbound && !get_at(i)->is_bound()) { // unbound elements are encoded as { "metainfo []" : "unbound" } enc_len += p_tok.put_next_token(JSON_TOKEN_OBJECT_START, NULL); enc_len += p_tok.put_next_token(JSON_TOKEN_NAME, "metainfo []"); @@ -1550,7 +1550,7 @@ int Record_Of_Type::JSON_encode_negtest(const Erroneous_descriptor_t* p_err_desc } } } - else if (NULL != p_td.json && p_td.json->metainfo_unbound && !get_at(i)->is_bound()) { + else if (p_td.json->metainfo_unbound && !get_at(i)->is_bound()) { // unbound elements are encoded as { "metainfo []" : "unbound" } enc_len += p_tok.put_next_token(JSON_TOKEN_OBJECT_START, NULL); enc_len += p_tok.put_next_token(JSON_TOKEN_NAME, "metainfo []"); @@ -1616,7 +1616,7 @@ int Record_Of_Type::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenize for (int nof_elements = 0; TRUE; ++nof_elements) { // Read value tokens until we reach some other token size_t buf_pos = p_tok.get_buf_pos(); - if (NULL != p_td.json && p_td.json->metainfo_unbound) { + if (p_td.json->metainfo_unbound) { // check for metainfo object size_t ret_val = p_tok.get_next_token(&token, NULL, NULL); if (JSON_TOKEN_OBJECT_START == token) { @@ -5975,7 +5975,7 @@ int Record_Type::JSON_encode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& return -1; } - if (NULL != p_td.json && p_td.json->as_value) { + if (p_td.json->as_value) { if (get_at(0)->is_optional()) { // can only happen if the record has the 'JSON:object' attribute; // in this case 'omit' is the same as if the field was an empty record of @@ -6042,7 +6042,7 @@ int Record_Type::JSON_encode_negtest(const Erroneous_descriptor_t* p_err_descr, return -1; } - boolean as_value = NULL != p_td.json && p_td.json->as_value; + boolean as_value = p_td.json->as_value; int enc_len = (as_value || p_parent_is_map) ? 0 : p_tok.put_next_token(JSON_TOKEN_OBJECT_START, NULL); @@ -6186,7 +6186,7 @@ int Record_Type::JSON_encode_negtest(const Erroneous_descriptor_t* p_err_descr, int Record_Type::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& p_tok, boolean p_silent, boolean p_parent_is_map, int) { - if (NULL != p_td.json && p_td.json->as_value) { + if (p_td.json->as_value) { if (get_at(0)->is_optional()) { // can only happen if the record has the 'JSON:object' attribute; // in this case the optional class must not be allowed to decode the