Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com> --- src/ResConfig.c | 40 +++++++++------------------------------- 1 files changed, 9 insertions(+), 31 deletions(-)
diff --git a/src/ResConfig.c b/src/ResConfig.c index 63afb18..68da536 100644 --- a/src/ResConfig.c +++ b/src/ResConfig.c @@ -174,18 +174,13 @@ _set_resource_values ( * create resource name string */ if (resource_name) { - temp = XtMalloc (sizeof(char) * - (2 + strlen(cur->core.name) - + strlen(resource_name))); - sprintf (temp, ".%s%s", cur->core.name, resource_name); + XtAsprintf (&temp, ".%s%s", cur->core.name, resource_name); XtFree (resource_name); } else if (!XtIsWidget (cur) || !cur->core.name) { cur = XtParent(cur); continue; } else { - temp = XtMalloc (sizeof(char) * - (2 + strlen(cur->core.name))); - sprintf (temp, ".%s", cur->core.name); + XtAsprintf (&temp, ".%s", cur->core.name); } resource_name = temp; @@ -197,31 +192,19 @@ _set_resource_values ( (ApplicationShellWidget) (cur); if (resource_class) { - temp = XtMalloc (sizeof(char) * - (2 + strlen(top->application.class) - + strlen(resource_class))); - sprintf (temp, ".%s%s", + XtAsprintf (&temp, ".%s%s", top->application.class, resource_class); } else { - temp = XtMalloc (sizeof(char) * - (2 + strlen(top->application.class))); - sprintf (temp, ".%s", + XtAsprintf (&temp, ".%s", top->application.class); } } else { if (resource_class) { - temp = XtMalloc (sizeof(char) * - (2 + strlen( - cur->core.widget_class->core_class.class_name) - + strlen(resource_class))); - sprintf (temp, ".%s%s", + XtAsprintf (&temp, ".%s%s", cur->core.widget_class->core_class.class_name, resource_class); } else { - temp = XtMalloc (sizeof(char) * - (2 + strlen( - cur->core.widget_class->core_class.class_name))); - sprintf (temp, ".%s", + XtAsprintf (&temp, ".%s", cur->core.widget_class->core_class.class_name); } } @@ -235,9 +218,7 @@ _set_resource_values ( /* * add the resource name to the end of the resource name string */ - temp = XtMalloc (2 + strlen(resource_name) + - strlen(resources_return[res_index].resource_name)); - sprintf (temp, "%s.%s", resource_name, + XtAsprintf (&temp, "%s.%s", resource_name, resources_return[res_index].resource_name); if (resource_name != NULL) XtFree (resource_name); @@ -246,9 +227,7 @@ _set_resource_values ( /* * add the resource class to the end of the resource class string */ - temp = XtMalloc (2 + strlen(resource_class) + - strlen(resources_return[res_index].resource_class)); - sprintf (temp, "%s.%s", resource_class, + XtAsprintf (&temp, "%s.%s", resource_class, resources_return[res_index].resource_class); if (resource_class != NULL) XtFree (resource_class); @@ -757,8 +736,7 @@ _search_widget_tree ( */ } else { if (remainder[0] != '*' && remainder[0] != '.') { - copy = XtMalloc (strlen(remainder) + 2); - sprintf (copy, ".%s", remainder); + XtAsprintf (©, ".%s", remainder); XtFree (remainder); remainder = copy; } -- 1.7.3.2 _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel