aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/X11/omGeneric.c
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/lib/X11/omGeneric.c')
-rw-r--r--nx-X11/lib/X11/omGeneric.c50
1 files changed, 16 insertions, 34 deletions
diff --git a/nx-X11/lib/X11/omGeneric.c b/nx-X11/lib/X11/omGeneric.c
index fd8742436..6b5e30a69 100644
--- a/nx-X11/lib/X11/omGeneric.c
+++ b/nx-X11/lib/X11/omGeneric.c
@@ -523,9 +523,7 @@ get_font_name(
if (list == NULL)
return NULL;
- name = (char *) Xmalloc(strlen(*list) + 1);
- if (name)
- strcpy(name, *list);
+ name = strdup(*list);
XFreeFontNames(list);
@@ -549,10 +547,9 @@ get_rotate_fontname(
|| len > XLFD_MAX_LEN)
return NULL;
- pattern = (char *)Xmalloc(len + 1);
+ pattern = strdup(font_name);
if(!pattern)
return NULL;
- strcpy(pattern, font_name);
memset(fields, 0, sizeof(char *) * 14);
ptr = pattern;
@@ -663,10 +660,8 @@ get_font_name_from_list(
for (i = 0; i < count; i++) {
fname = list[i];
if(is_match_charset(font_data, fname) == True) {
- name = (char *) Xmalloc(strlen(fname) + 1);
- if (name)
- strcpy(name, fname);
- break;
+ name = strdup(fname);
+ break;
}
}
@@ -687,11 +682,10 @@ parse_all_name(
if(is_match_charset(font_data, pattern) != True)
return False;
- font_data->xlfd_name = (char *)Xmalloc(strlen(pattern)+1);
+ font_data->xlfd_name = strdup(pattern);
if(font_data->xlfd_name == NULL)
return (-1);
- strcpy(font_data->xlfd_name, pattern);
return True;
#else /* OLDCODE */
Display *dpy = oc->core.om->core.display;
@@ -725,11 +719,10 @@ parse_all_name(
}
}
- font_data->xlfd_name = (char *)Xmalloc(strlen(pattern)+1);
+ font_data->xlfd_name = strdup(pattern);
if(font_data->xlfd_name == NULL)
return (-1);
- strcpy(font_data->xlfd_name, pattern);
return True;
#endif /* OLDCODE */
}
@@ -948,12 +941,9 @@ parse_fontdata(
* -- jjw/pma (HP)
*/
if (font_data_return) {
- font_data_return->xlfd_name = (char *)Xmalloc
- (strlen(font_data->xlfd_name) + 1);
+ font_data_return->xlfd_name = strdup(font_data->xlfd_name);
if (!font_data_return->xlfd_name) return -1;
- strcpy (font_data_return->xlfd_name, font_data->xlfd_name);
-
font_data_return->side = font_data->side;
}
#ifdef FONTDEBUG
@@ -998,11 +988,9 @@ parse_fontdata(
#ifdef FONTDEBUG
fprintf(stderr,"XLFD name: %s\n",font_data->xlfd_name);
#endif
- font_data_return->xlfd_name = (char *)Xmalloc
- (strlen(font_data->xlfd_name) + 1);
+ font_data_return->xlfd_name = strdup(font_data->xlfd_name);
if (!font_data_return->xlfd_name) return -1;
- strcpy (font_data_return->xlfd_name, font_data->xlfd_name);
font_data_return->side = font_data->side;
}
@@ -1194,11 +1182,10 @@ parse_fontname(
* be matched. It returns the required information in
* font_data_return.
*/
- font_set->font_name = (char *)Xmalloc
- (strlen(font_data_return.xlfd_name) + 1);
+ font_set->font_name = strdup(font_data_return.xlfd_name);
if(font_set->font_name == (char *) NULL)
goto err;
- strcpy(font_set->font_name, font_data_return.xlfd_name);
+
font_set->side = font_data_return.side;
Xfree (font_data_return.xlfd_name);
@@ -1225,11 +1212,10 @@ parse_fontname(
break;
}
}
- font_set->font_name = (char *)Xmalloc
- (strlen(font_set->substitute[i].xlfd_name) + 1);
+ font_set->font_name = strdup(font_set->substitute[i].xlfd_name);
if(font_set->font_name == (char *) NULL)
goto err;
- strcpy(font_set->font_name,font_set->substitute[i].xlfd_name);
+
font_set->side = font_set->substitute[i].side;
if(parse_vw(oc, font_set, name_list, count) == -1)
goto err;
@@ -1239,11 +1225,10 @@ parse_fontname(
}
}
- base_name = (char *) Xmalloc(strlen(oc->core.base_name_list) + 1);
+ base_name = strdup(oc->core.base_name_list);
if (base_name == NULL)
goto err;
- strcpy(base_name, oc->core.base_name_list);
oc->core.base_name_list = base_name;
XFreeStringList(name_list);
@@ -1852,16 +1837,14 @@ create_om(
om->core.display = dpy;
om->core.rdb = rdb;
if (res_name) {
- om->core.res_name = (char *) Xmalloc(strlen(res_name) + 1);
+ om->core.res_name = strdup(res_name);
if (om->core.res_name == NULL)
goto err;
- strcpy(om->core.res_name, res_name);
}
if (res_class) {
- om->core.res_class = (char *) Xmalloc(strlen(res_class) + 1);
+ om->core.res_class = strdup(res_class);
if (om->core.res_class == NULL)
goto err;
- strcpy(om->core.res_class, res_class);
}
if (om_resources[0].xrm_name == NULLQUARK)
@@ -2014,10 +1997,9 @@ init_om(
_XlcGetResource(lcd, "XLC_FONTSET", "object_name", &value, &count);
if (count > 0) {
- gen->object_name = (char *) Xmalloc(strlen(*value) + 1);
+ gen->object_name = strdup(*value);
if (gen->object_name == NULL)
return False;
- strcpy(gen->object_name, *value);
}
for (num = 0; ; num++) {