diff options
author | walter harms <wharms@bfs.de> | 2016-04-26 16:34:11 +0200 |
---|---|---|
committer | Ulrich Sibiller <u.sibiller@science-computing.de> | 2016-10-20 10:16:35 +0200 |
commit | 3f9ebf33d49b6e92b4a6a88adfa5de0dd7471fae (patch) | |
tree | 58477b5e49e9678eec5f76b8ab6993934e33d84c | |
parent | 897b8b28b34b3f4c12aca073176df7781d801dfc (diff) | |
download | nx-libs-3f9ebf33d49b6e92b4a6a88adfa5de0dd7471fae.tar.gz nx-libs-3f9ebf33d49b6e92b4a6a88adfa5de0dd7471fae.tar.bz2 nx-libs-3f9ebf33d49b6e92b4a6a88adfa5de0dd7471fae.zip |
no need to check args for Xfree()
simplify code
Signed-off-by: walter harms <wharms@bfs.de>
-rw-r--r-- | nx-X11/lib/X11/lcGeneric.c | 74 |
1 files changed, 33 insertions, 41 deletions
diff --git a/nx-X11/lib/X11/lcGeneric.c b/nx-X11/lib/X11/lcGeneric.c index 1c78a95c6..58ee5d27c 100644 --- a/nx-X11/lib/X11/lcGeneric.c +++ b/nx-X11/lib/X11/lcGeneric.c @@ -1027,10 +1027,8 @@ freeByteM( } blst = codeset->byteM; for (i = 0; i < codeset->length; i++) { - if (blst[i].byteinfo) { Xfree(blst[i].byteinfo); blst[i].byteinfo = NULL; - } } Xfree(codeset->byteM); codeset->byteM = NULL; @@ -1044,20 +1042,18 @@ freeConversion( if (codeset->mbconv) { mbconv = codeset->mbconv; /* ... */ - if (mbconv->convlist) { - Xfree(mbconv->convlist); - mbconv->convlist = NULL; - } + Xfree(mbconv->convlist); + mbconv->convlist = NULL; + Xfree(mbconv); codeset->mbconv = NULL; } if (codeset->ctconv) { ctconv = codeset->ctconv; /* ... */ - if (ctconv->convlist) { - Xfree(ctconv->convlist); - ctconv->convlist = NULL; - } + Xfree(ctconv->convlist); + ctconv->convlist = NULL; + Xfree(ctconv); codeset->ctconv = NULL; } @@ -1072,14 +1068,12 @@ freeExtdSegment( return; } ctextseg = codeset->ctextseg; - if (ctextseg->name) { - Xfree(ctextseg->name); - ctextseg->name = NULL; - } - if (ctextseg->area) { - Xfree(ctextseg->area); - ctextseg->area = NULL; - } + Xfree(ctextseg->name); + ctextseg->name = NULL; + + Xfree(ctextseg->area); + ctextseg->area = NULL; + Xfree(codeset->ctextseg); codeset->ctextseg = NULL; } @@ -1093,10 +1087,10 @@ freeParseInfo( return; } parse_info = codeset->parse_info; - if (parse_info->encoding) { - Xfree(parse_info->encoding); - parse_info->encoding = NULL; - } + + Xfree(parse_info->encoding); + parse_info->encoding = NULL; + Xfree(codeset->parse_info); codeset->parse_info = NULL; } @@ -1115,10 +1109,10 @@ destroy_CodeSetList( freeConversion(codeset[i]); freeExtdSegment(codeset[i]); freeParseInfo(codeset[i]); - if (codeset[i]->charset_list) { - Xfree(codeset[i]->charset_list); - codeset[i]->charset_list = NULL; - } + + Xfree(codeset[i]->charset_list); + codeset[i]->charset_list = NULL; + Xfree(codeset[i]); codeset[i]=NULL; } Xfree(codeset); gen->codeset_list = NULL; @@ -1130,21 +1124,20 @@ destroy_SegConv( { SegConv seg = gen->segment_conv; int i; + if (gen->segment_conv_num == 0) { return; } for (i=0;i<gen->segment_conv_num;i++) { - if (seg[i].source_encoding) { + Xfree(seg[i].source_encoding); seg[i].source_encoding = NULL; - } - if (seg[i].destination_encoding) { + Xfree(seg[i].destination_encoding); seg[i].destination_encoding = NULL; - } - if (seg[i].conv) { - Xfree(seg[i].conv); seg[i].conv = NULL; - } + + Xfree(seg[i].conv); + seg[i].conv = NULL; } Xfree(seg); gen->segment_conv = NULL; } @@ -1156,14 +1149,13 @@ destroy_gen( XLCdGenericPart *gen = XLC_GENERIC_PART(lcd); destroy_SegConv(gen); destroy_CodeSetList(gen); - if (gen->mb_parse_table) { - Xfree(gen->mb_parse_table); - gen->mb_parse_table = NULL; - } - if (gen->mb_parse_list) { - Xfree(gen->mb_parse_list); - gen->mb_parse_list = NULL; - } + + Xfree(gen->mb_parse_table); + gen->mb_parse_table = NULL; + + Xfree(gen->mb_parse_list); + gen->mb_parse_list = NULL; + } /* VW/UDC end 95.01.08 */ |