diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2009-03-13 22:06:48 +0000 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2009-03-13 22:06:48 +0000 |
commit | 62f60df6b4966d4e3d7f478284768115ef150b20 (patch) | |
tree | 259b574936077d87b88ed6d0429ba317078e0fcc /epan/uat.h | |
parent | 7ed615f165fcb0cc87c2aba1921fb87a8a384ca5 (diff) |
From Jakub Zawadzki (bug 3331):
g_free() is NULL safe, so we don't need check against it.
svn path=/trunk/; revision=27718
Diffstat (limited to 'epan/uat.h')
-rw-r--r-- | epan/uat.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/epan/uat.h b/epan/uat.h index 1ba3bfa5e0..7977e78e14 100644 --- a/epan/uat.h +++ b/epan/uat.h @@ -324,7 +324,7 @@ gboolean uat_fld_chk_str_ ## what (void* u1 _U_, const char* strptr, unsigned le #define UAT_CSTRING_CB_DEF(basename,field_name,rec_t) \ static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf, unsigned len, void* u1 _U_, void* u2 _U_) {\ char* new_buf = g_strndup(buf,len); \ - if ((((rec_t*)rec)->field_name)) g_free((((rec_t*)rec)->field_name)); \ + g_free((((rec_t*)rec)->field_name)); \ (((rec_t*)rec)->field_name) = new_buf; } \ static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out_ptr, unsigned* out_len, void* u1 _U_, void* u2 _U_) {\ if (((rec_t*)rec)->field_name ) { \ @@ -354,7 +354,7 @@ static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out #define UAT_LSTRING_CB_DEF(basename,field_name,rec_t,ptr_element,len_element) \ static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf, unsigned len, void* u1 _U_, void* u2 _U_) {\ char* new_val = uat_unesc(buf,len,&(((rec_t*)rec)->len_element)); \ - if ((((rec_t*)rec)->ptr_element)) g_free((((rec_t*)rec)->ptr_element)); \ + g_free((((rec_t*)rec)->ptr_element)); \ (((rec_t*)rec)->ptr_element) = new_val; }\ static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out_ptr, unsigned* out_len, void* u1 _U_, void* u2 _U_) {\ if (((rec_t*)rec)->ptr_element ) { \ @@ -376,9 +376,9 @@ static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out #define UAT_BUFFER_CB_DEF(basename,field_name,rec_t,ptr_element,len_element) \ static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf, unsigned len, void* u1 _U_, void* u2 _U_) {\ char* new_buf = len ? g_memdup(buf,len) : NULL; \ - if ((((rec_t*)rec)->ptr_element) ) g_free((((rec_t*)rec)->ptr_element)); \ - (((rec_t*)rec)->ptr_element) = new_buf; \ - (((rec_t*)rec)->len_element) = len; } \ + g_free((((rec_t*)rec)->ptr_element)); \ + (((rec_t*)rec)->ptr_element) = new_buf; \ + (((rec_t*)rec)->len_element) = len; } \ static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out_ptr, unsigned* out_len, void* u1 _U_, void* u2 _U_) {\ *out_ptr = ((rec_t*)rec)->ptr_element ? ep_memdup(((rec_t*)rec)->ptr_element,((rec_t*)rec)->len_element) : ""; \ *out_len = ((rec_t*)rec)->len_element; } |