aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/X11/XDefaultOMIF.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-08-10 13:37:53 -0700
committerUlrich Sibiller <uli42@gmx.de>2016-10-19 21:40:28 +0200
commit22377a799a141ba6b1e43b83de4a506b36a842a4 (patch)
tree70672e485c07a72956848a0bb313320dafcfce8d /nx-X11/lib/X11/XDefaultOMIF.c
parent92591316d2698f48e9021d0c2c0e4f5ec3b29880 (diff)
downloadnx-libs-22377a799a141ba6b1e43b83de4a506b36a842a4.tar.gz
nx-libs-22377a799a141ba6b1e43b83de4a506b36a842a4.tar.bz2
nx-libs-22377a799a141ba6b1e43b83de4a506b36a842a4.zip
init_om: remove unneeded extra copy of string to local buffer
Strings from the supported_charset_list[] were being copied one by one to a stack buffer, and then strdup called on that buffer. Instead, just strdup the original string, without the local copy, and use a more traditional for loop, so it's easier to figure out what the code is doing (cleaning up a gcc const-cast warning in the process). Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Matthieu Herrb <matthieu.herrb@laas.fr> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
Diffstat (limited to 'nx-X11/lib/X11/XDefaultOMIF.c')
-rw-r--r--nx-X11/lib/X11/XDefaultOMIF.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/nx-X11/lib/X11/XDefaultOMIF.c b/nx-X11/lib/X11/XDefaultOMIF.c
index 9e6feb76b..a8faa2af1 100644
--- a/nx-X11/lib/X11/XDefaultOMIF.c
+++ b/nx-X11/lib/X11/XDefaultOMIF.c
@@ -1148,10 +1148,9 @@ init_om(
FontData font_data;
char **required_list;
XOrientation *orientation;
- char **value, buf[BUFSIZ], *bufptr;
- int count, length = 0;
+ char *bufptr;
+ int i, count, length = 0;
- value = (char**)supported_charset_list;
count = XlcNumber(supported_charset_list);
data = add_data(om);
@@ -1164,14 +1163,8 @@ init_om(
data->font_data = font_data;
data->font_data_count = count;
- for ( ; count-- > 0; font_data++) {
-/*
-1266793
-This one is fine. *value points to one of the local strings in
-supported_charset_list[].
-*/
- strcpy(buf, *value++);
- font_data->name = strdup(buf);
+ for (i = 0; i < count; i++, font_data++) {
+ font_data->name = strdup(supported_charset_list[i]);
if (font_data->name == NULL)
return False;
}