diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2015-12-19 10:00:22 -0800 |
---|---|---|
committer | Ulrich Sibiller <uli42@gmx.de> | 2016-10-19 21:40:30 +0200 |
commit | d980be3c2c3c39bc4db64388b992d4535cbffcd6 (patch) | |
tree | 680e01773c8270fb5406906dc26d51fa85db35fa | |
parent | c00196d2d178b4ed1866c18ccab76cbb941df6f0 (diff) | |
download | nx-libs-d980be3c2c3c39bc4db64388b992d4535cbffcd6.tar.gz nx-libs-d980be3c2c3c39bc4db64388b992d4535cbffcd6.tar.bz2 nx-libs-d980be3c2c3c39bc4db64388b992d4535cbffcd6.zip |
XDefaultOMIF: additional code simplification
Don't need to test for a case that we already returned for, don't need
to store a count that will only ever be 1 if we didn't return, don't
need to increment pointers to allow storing more than one item when we
can only ever possibly do one.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
-rw-r--r-- | nx-X11/lib/X11/XDefaultOMIF.c | 43 |
1 files changed, 11 insertions, 32 deletions
diff --git a/nx-X11/lib/X11/XDefaultOMIF.c b/nx-X11/lib/X11/XDefaultOMIF.c index f7b1b1d8c..e38739a0a 100644 --- a/nx-X11/lib/X11/XDefaultOMIF.c +++ b/nx-X11/lib/X11/XDefaultOMIF.c @@ -237,15 +237,10 @@ init_core_part( FontSet font_set; XFontStruct **font_struct_list; char **font_name_list, *font_name_buf; - int count; font_set = gen->font_set; - count = 0; - if (font_set->font_name != NULL) { - count++; - } - if (count == 0) + if (font_set->font_name == NULL) return False; font_struct_list = Xmalloc(sizeof(XFontStruct *)); @@ -264,18 +259,13 @@ init_core_part( oc->core.font_info.font_name_list = font_name_list; oc->core.font_info.font_struct_list = font_struct_list; - font_set = gen->font_set; - - if (font_set->font_name != NULL) { - font_set->id = 1; - if (font_set->font) - *font_struct_list++ = font_set->font; - else - *font_struct_list++ = font_set->info; - Xfree(font_set->font_name); - *font_name_list++ = font_set->font_name = font_name_buf; - font_name_buf += strlen(font_name_buf) + 1; - } + font_set->id = 1; + if (font_set->font) + *font_struct_list = font_set->font; + else + *font_struct_list = font_set->info; + Xfree(font_set->font_name); + *font_name_list = font_set->font_name = font_name_buf; set_fontset_extents(oc); @@ -480,16 +470,10 @@ set_missing_list( XOCGenericPart *gen = XOC_GENERIC(oc); FontSet font_set; char **charset_list, *charset_buf; - int count; font_set = gen->font_set; - count = 0; - - if (!font_set->info && !font_set->font) { - count++; - } - if (count == 0) + if (font_set->info == NULL || font_set->font == NULL) return True; charset_list = Xmalloc(sizeof(char *)); @@ -504,12 +488,8 @@ set_missing_list( oc->core.missing_list.charset_list = charset_list; - font_set = gen->font_set; + *charset_list = charset_buf; - if (!font_set->info && !font_set->font) { - *charset_list++ = charset_buf; - charset_buf += strlen(charset_buf) + 1; - } return True; } @@ -1090,8 +1070,7 @@ init_om( data = gen->data; - *required_list++ = bufptr; - bufptr += strlen(bufptr) + 1; + *required_list = bufptr; /* orientation list */ orientation = Xmalloc(sizeof(XOrientation)); |