aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nx-X11/lib/X11/FSWrap.c3
-rw-r--r--nx-X11/lib/X11/InitExt.c3
-rw-r--r--nx-X11/lib/X11/PrOfId.c11
-rw-r--r--nx-X11/lib/X11/SetLocale.c3
-rw-r--r--nx-X11/lib/X11/XDefaultIMIF.c6
-rw-r--r--nx-X11/lib/X11/XDefaultOMIF.c25
-rw-r--r--nx-X11/lib/X11/XKBGAlloc.c13
-rw-r--r--nx-X11/lib/X11/imInt.c6
-rw-r--r--nx-X11/lib/X11/imRm.c19
-rw-r--r--nx-X11/lib/X11/imTrans.c3
-rw-r--r--nx-X11/lib/X11/lcDB.c12
-rw-r--r--nx-X11/lib/X11/lcFile.c14
-rw-r--r--nx-X11/lib/X11/lcGeneric.c18
-rw-r--r--nx-X11/lib/X11/lcPublic.c3
-rw-r--r--nx-X11/lib/X11/omGeneric.c50
15 files changed, 59 insertions, 130 deletions
diff --git a/nx-X11/lib/X11/FSWrap.c b/nx-X11/lib/X11/FSWrap.c
index df65654a9..043e5dc3a 100644
--- a/nx-X11/lib/X11/FSWrap.c
+++ b/nx-X11/lib/X11/FSWrap.c
@@ -85,10 +85,9 @@ _XParseBaseFontNameList(
if (!*str)
return (char **)NULL;
- if (!(ptr = Xmalloc((unsigned)strlen(str) + 1))) {
+ if (!(ptr = strdup(str))) {
return (char **)NULL;
}
- strcpy(ptr, str);
psave = ptr;
/* somebody who specifies more than XMAXLIST basefontnames will lose */
diff --git a/nx-X11/lib/X11/InitExt.c b/nx-X11/lib/X11/InitExt.c
index 21c392c0e..fdadd9ef7 100644
--- a/nx-X11/lib/X11/InitExt.c
+++ b/nx-X11/lib/X11/InitExt.c
@@ -50,14 +50,13 @@ XExtCodes *XInitExtension (
LockDisplay (dpy);
if (! (ext = (_XExtension *) Xcalloc (1, sizeof (_XExtension))) ||
- ! (ext->name = Xmalloc((unsigned) strlen(name) + 1))) {
+ ! (ext->name = strdup(name))) {
if (ext) Xfree((char *) ext);
UnlockDisplay(dpy);
return (XExtCodes *) NULL;
}
codes.extension = dpy->ext_number++;
ext->codes = codes;
- (void) strcpy(ext->name, name);
/* chain it onto the display list */
ext->next = dpy->ext_procs;
diff --git a/nx-X11/lib/X11/PrOfId.c b/nx-X11/lib/X11/PrOfId.c
index 831f17ab9..a96d28cec 100644
--- a/nx-X11/lib/X11/PrOfId.c
+++ b/nx-X11/lib/X11/PrOfId.c
@@ -66,7 +66,6 @@ XcmsPrefixOfFormat(
*/
{
XcmsColorSpace **papColorSpaces;
- char *prefix;
/*
* First try Device-Independent color spaces
@@ -75,10 +74,7 @@ XcmsPrefixOfFormat(
if (papColorSpaces != NULL) {
while (*papColorSpaces != NULL) {
if ((*papColorSpaces)->id == id) {
- prefix = (char *)Xmalloc((strlen((*papColorSpaces)->prefix) +
- 1) * sizeof(char));
- strcpy(prefix, (*papColorSpaces)->prefix);
- return(prefix);
+ return strdup((*papColorSpaces)->prefix);
}
papColorSpaces++;
}
@@ -91,10 +87,7 @@ XcmsPrefixOfFormat(
if (papColorSpaces != NULL) {
while (*papColorSpaces != NULL) {
if ((*papColorSpaces)->id == id) {
- prefix = (char *)Xmalloc((strlen((*papColorSpaces)->prefix) +
- 1) * sizeof(char));
- strcpy(prefix, (*papColorSpaces)->prefix);
- return(prefix);
+ return strdup((*papColorSpaces)->prefix);
}
papColorSpaces++;
}
diff --git a/nx-X11/lib/X11/SetLocale.c b/nx-X11/lib/X11/SetLocale.c
index cf068403b..9ada0fb90 100644
--- a/nx-X11/lib/X11/SetLocale.c
+++ b/nx-X11/lib/X11/SetLocale.c
@@ -103,13 +103,12 @@ _Xsetlocale(
if (!methods)
return NULL;
name = (*methods->lcname)(state);
- xsl_name = Xmalloc(strlen(name) + 1);
+ xsl_name = strdup(name);
if (!xsl_name) {
xsl_name = old_name;
(*methods->destroy)(state);
return NULL;
}
- strcpy(xsl_name, name);
if (old_name)
Xfree(old_name);
(*methods->destroy)(state);
diff --git a/nx-X11/lib/X11/XDefaultIMIF.c b/nx-X11/lib/X11/XDefaultIMIF.c
index d36962f05..135c5a259 100644
--- a/nx-X11/lib/X11/XDefaultIMIF.c
+++ b/nx-X11/lib/X11/XDefaultIMIF.c
@@ -226,12 +226,10 @@ _XDefaultOpenIM(
local_impart->ctow_conv = ctow_conv;
if ((res_name != NULL) && (*res_name != '\0')){
- im->core.res_name = (char *)Xmalloc(strlen(res_name)+1);
- strcpy(im->core.res_name,res_name);
+ im->core.res_name = strdup(res_name);
}
if ((res_class != NULL) && (*res_class != '\0')){
- im->core.res_class = (char *)Xmalloc(strlen(res_class)+1);
- strcpy(im->core.res_class,res_class);
+ im->core.res_class = strdup(res_class);
}
return (XIM)im;
diff --git a/nx-X11/lib/X11/XDefaultOMIF.c b/nx-X11/lib/X11/XDefaultOMIF.c
index b74683aa7..26c6c3a98 100644
--- a/nx-X11/lib/X11/XDefaultOMIF.c
+++ b/nx-X11/lib/X11/XDefaultOMIF.c
@@ -216,9 +216,8 @@ check_fontname(
fname = prop_fname;
}
if (data) {
- font_set->font_name = (char *) Xmalloc(strlen(fname) + 1);
+ font_set->font_name = strdup(fname);
if (font_set->font_name) {
- strcpy(font_set->font_name, fname);
found_num++;
}
}
@@ -387,9 +386,7 @@ get_font_name(
list = XListFonts(dpy, pattern, 1, &count);
if (list != NULL) {
- name = (char *) Xmalloc(strlen(*list) + 1);
- if (name)
- strcpy(name, *list);
+ name = strdup(*list);
XFreeFontNames(list);
} else {
@@ -459,13 +456,11 @@ parse_fontname(
if (font_data == NULL)
continue;
- font_set->font_name = (char *) Xmalloc(strlen(font_name) + 1);
+ font_set->font_name = strdup(font_name);
+ Xfree(font_name);
if (font_set->font_name == NULL) {
- Xfree(font_name);
goto err;
}
- strcpy(font_set->font_name, font_name);
- Xfree(font_name);
found_num++;
goto found;
}
@@ -548,11 +543,10 @@ Limit the length of the string copy to prevent stack corruption.
}
}
found:
- 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);
@@ -1177,10 +1171,9 @@ This one is fine. *value points to one of the local strings in
supported_charset_list[].
*/
strcpy(buf, *value++);
- font_data->name = (char *) Xmalloc(strlen(buf) + 1);
+ font_data->name = strdup(buf);
if (font_data->name == NULL)
return False;
- strcpy(font_data->name, buf);
}
length += strlen(data->font_data->name) + 1;
@@ -1241,16 +1234,14 @@ _XDefaultOpenOM(XLCd lcd, Display *dpy, XrmDatabase rdb,
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)
diff --git a/nx-X11/lib/X11/XKBGAlloc.c b/nx-X11/lib/X11/XKBGAlloc.c
index 489d41b78..fa405fb9c 100644
--- a/nx-X11/lib/X11/XKBGAlloc.c
+++ b/nx-X11/lib/X11/XKBGAlloc.c
@@ -684,9 +684,7 @@ register XkbPropertyPtr prop;
if ((prop->name)&&(strcmp(name,prop->name)==0)) {
if (prop->value)
_XkbFree(prop->value);
- prop->value= (char *)_XkbAlloc(strlen(value)+1);
- if (prop->value)
- strcpy(prop->value,value);
+ prop->value= strdup(value);
return prop;
}
}
@@ -695,17 +693,15 @@ register XkbPropertyPtr prop;
return NULL;
}
prop= &geom->properties[geom->num_properties];
- prop->name= (char *)_XkbAlloc(strlen(name)+1);
+ prop->name= strdup(name);
if (!prop->name)
return NULL;
- strcpy(prop->name,name);
- prop->value= (char *)_XkbAlloc(strlen(value)+1);
+ prop->value= strdup(value);
if (!prop->value) {
_XkbFree(prop->name);
prop->name= NULL;
return NULL;
}
- strcpy(prop->value,value);
geom->num_properties++;
return prop;
}
@@ -757,10 +753,9 @@ register XkbColorPtr color;
}
color= &geom->colors[geom->num_colors];
color->pixel= pixel;
- color->spec= (char *)_XkbAlloc(strlen(spec)+1);
+ color->spec= strdup(spec);
if (!color->spec)
return NULL;
- strcpy(color->spec,spec);
geom->num_colors++;
return color;
}
diff --git a/nx-X11/lib/X11/imInt.c b/nx-X11/lib/X11/imInt.c
index bab4b5399..0c7cc6f1a 100644
--- a/nx-X11/lib/X11/imInt.c
+++ b/nx-X11/lib/X11/imInt.c
@@ -214,14 +214,12 @@ _XimOpenIM(
im->core.res_name = NULL;
im->core.res_class = NULL;
if((res_name != NULL) && (*res_name != '\0')){
- if(!(im->core.res_name = (char *)Xmalloc(strlen(res_name)+1)))
+ if(!(im->core.res_name = strdup(res_name)))
goto Error1;
- strcpy(im->core.res_name,res_name);
}
if((res_class != NULL) && (*res_class != '\0')){
- if(!(im->core.res_class = (char *)Xmalloc(strlen(res_class)+1)))
+ if(!(im->core.res_class = strdup(res_class)))
goto Error2;
- strcpy(im->core.res_class,res_class);
}
if(!(im->core.im_name = _XimMakeImName(lcd)))
goto Error3;
diff --git a/nx-X11/lib/X11/imRm.c b/nx-X11/lib/X11/imRm.c
index 448cf41e6..3c28b1e29 100644
--- a/nx-X11/lib/X11/imRm.c
+++ b/nx-X11/lib/X11/imRm.c
@@ -793,19 +793,15 @@ _XimEncodeString(
XPointer top,
XPointer val)
{
- int len;
char *string;
char **out;
if(val == (XPointer)NULL) {
return False;
}
- len = strlen((char *)val);
- if(!(string = (char *)Xmalloc(len + 1))) {
+ if (!(string = strdup((char *)val))) {
return False;
}
- (void)strcpy(string, (char *)val);
- string[len] = '\0';
out = (char **)((char *)top + info->offset);
if(*out) {
@@ -1163,21 +1159,18 @@ _XimDecodeString(
XPointer top,
XPointer val)
{
- int len = 0;
char *in;
char *string;
in = *((char **)((char *)top + info->offset));
- if(in != (char *)NULL) {
- len = strlen(in);
+ if (in != NULL) {
+ string = strdup(in);
+ } else {
+ string = Xcalloc(1, 1); /* strdup("") */
}
- if(!(string = (char *)Xmalloc(len + 1))) {
+ if (string == NULL) {
return False;
}
- if(in != (char *)NULL) {
- (void)strcpy(string, in);
- }
- string[len] = '\0';
*((char **)val) = string;
return True;
}
diff --git a/nx-X11/lib/X11/imTrans.c b/nx-X11/lib/X11/imTrans.c
index a974c0ca3..4c4651599 100644
--- a/nx-X11/lib/X11/imTrans.c
+++ b/nx-X11/lib/X11/imTrans.c
@@ -290,7 +290,7 @@ _XimTransConf(
char *paddr;
TransSpecRec *spec;
- if (!(paddr = (char *)Xmalloc(strlen(address) + 1)))
+ if (!(paddr = strdup(address)))
return False;
if (!(spec = Xcalloc(1, sizeof(TransSpecRec)))) {
@@ -298,7 +298,6 @@ _XimTransConf(
return False;
}
- (void)strcpy(paddr, address);
spec->address = paddr;
im->private.proto.spec = (XPointer)spec;
diff --git a/nx-X11/lib/X11/lcDB.c b/nx-X11/lib/X11/lcDB.c
index c11a79a6b..027d7747b 100644
--- a/nx-X11/lib/X11/lcDB.c
+++ b/nx-X11/lib/X11/lcDB.c
@@ -596,20 +596,18 @@ store_to_database(
goto err;
}
- new->category = (char *)Xmalloc(strlen(parse_info.category) + 1);
+ new->category = strdup(parse_info.category);
if (new->category == NULL) {
goto err;
}
- strcpy(new->category, parse_info.category);
if (! construct_name(name, sizeof(name))) {
goto err;
}
- new->name = (char *)Xmalloc(strlen(name) + 1);
+ new->name = strdup(name);
if (new->name == NULL) {
goto err;
}
- strcpy(new->name, name);
new->next = *db;
new->value = parse_info.value;
new->value_num = parse_info.value_num;
@@ -943,10 +941,9 @@ f_default(
case S_NULL:
if (parse_info.category != NULL)
goto err;
- p = (char *)Xmalloc(strlen(wordp) + 1);
+ p = strdup(wordp);
if (p == NULL)
goto err;
- strcpy(p, wordp);
parse_info.category = p;
parse_info.pre_state = S_CATEGORY;
break;
@@ -960,10 +957,9 @@ f_default(
break;
}
}
- p = (char *)Xmalloc(strlen(wordp) + 1);
+ p = strdup(wordp);
if (p == NULL)
goto err;
- strcpy(p, wordp);
if (parse_info.name[parse_info.nest_depth] != NULL) {
Xfree(parse_info.name[parse_info.nest_depth]);
}
diff --git a/nx-X11/lib/X11/lcFile.c b/nx-X11/lib/X11/lcFile.c
index e657e707f..36f0ddf5a 100644
--- a/nx-X11/lib/X11/lcFile.c
+++ b/nx-X11/lib/X11/lcFile.c
@@ -401,10 +401,7 @@ resolve_name(
from = args[1], to = args[0]; /* right to left */
}
if (! strcmp(from, lc_name)) {
- name = Xmalloc(strlen(to) + 1);
- if (name != NULL) {
- strcpy(name, to);
- }
+ name = strdup(to);
break;
}
}
@@ -557,8 +554,7 @@ _XlcResolveLocaleName(
if (name == NULL) {
/* vendor locale name == Xlocale name, no expansion of alias */
- pub->siname = Xmalloc (strlen (lc_name) + 1);
- strcpy (pub->siname, lc_name);
+ pub->siname = strdup (lc_name);
} else {
pub->siname = name;
}
@@ -707,8 +703,7 @@ _XlcLocaleDirName(char *dir_name, size_t dir_len, char *lc_name)
last_dir_len = strlen (dir_name) + 1;
last_dir_name = Xmalloc (last_dir_len);
strcpy (last_dir_name, dir_name);
- last_lc_name = Xmalloc (strlen (lc_name) + 1);
- strcpy (last_lc_name, lc_name);
+ last_lc_name = strdup (lc_name);
return dir_name;
}
@@ -806,8 +801,7 @@ _XlcLocaleLibDirName(char *dir_name, size_t dir_len, char *lc_name)
last_dir_len = strlen (dir_name) + 1;
last_dir_name = Xmalloc (last_dir_len);
strcpy (last_dir_name, dir_name);
- last_lc_name = Xmalloc (strlen (lc_name) + 1);
- strcpy (last_lc_name, lc_name);
+ last_lc_name = strdup (lc_name);
return dir_name;
}
diff --git a/nx-X11/lib/X11/lcGeneric.c b/nx-X11/lib/X11/lcGeneric.c
index df392e9af..619cb47f9 100644
--- a/nx-X11/lib/X11/lcGeneric.c
+++ b/nx-X11/lib/X11/lcGeneric.c
@@ -215,10 +215,9 @@ add_parse_list(
unsigned char ch;
int num;
- str = (char *) Xmalloc(strlen(encoding) + 1);
+ str = strdup(encoding);
if (str == NULL)
return False;
- strcpy(str, encoding);
new = Xcalloc(1, sizeof(ParseInfoRec));
if (new == NULL)
@@ -463,10 +462,9 @@ read_charset_define(
break;
}
if (new) {
- tmp = (char *)Xmalloc(strlen(cset_name)+1);
+ tmp = strdup(cset_name);
if (tmp == NULL)
return;
- strcpy(tmp,cset_name);
charsetd->name = tmp;
}
/* side */
@@ -522,8 +520,7 @@ read_charset_define(
Xfree(charsetd->encoding_name);
}
*/
- tmp = (char *)Xmalloc(strlen(value[0])+1);
- strcpy(tmp,value[0]);
+ tmp = strdup(value[0]);
charsetd->encoding_name = tmp;
charsetd->xrm_encoding_name = XrmStringToQuark(tmp);
}
@@ -593,10 +590,9 @@ read_segmentconversion(
if (num > 0) {
char *tmp;
_XlcDbg_printValue(name,value,num);
- tmp = (char *)Xmalloc(strlen(value[0])+1);
+ tmp = strdup(value[0]);
if (tmp == NULL)
return;
- strcpy(tmp,value[0]);
conversion->source_encoding = tmp;
conversion->source = srch_charset_define(tmp,&new);
}
@@ -606,10 +602,9 @@ read_segmentconversion(
if (num > 0) {
char *tmp;
_XlcDbg_printValue(name,value,num);
- tmp = (char *)Xmalloc(strlen(value[0])+1);
+ tmp = strdup(value[0]);
if (tmp == NULL)
return;
- strcpy(tmp,value[0]);
conversion->destination_encoding = tmp;
conversion->dest = srch_charset_define(tmp,&new);
}
@@ -645,12 +640,11 @@ create_ctextseg(
ret = (ExtdSegment)Xmalloc(sizeof(ExtdSegmentRec));
if (ret == NULL)
return NULL;
- ret->name = (char *)Xmalloc(strlen(value[0]) + 1);
+ ret->name = strdup(value[0]);
if (ret->name == NULL) {
Xfree (ret);
return NULL;
}
- strcpy(ret->name,value[0]);
cset_name = (char*) Xmalloc (strlen(ret->name) + 1);
if (cset_name == NULL) {
Xfree (ret->name);
diff --git a/nx-X11/lib/X11/lcPublic.c b/nx-X11/lib/X11/lcPublic.c
index 43b9286e7..1b1fb548a 100644
--- a/nx-X11/lib/X11/lcPublic.c
+++ b/nx-X11/lib/X11/lcPublic.c
@@ -128,10 +128,9 @@ load_public(
_XlcGetResource(lcd, "XLC_XLOCALE", "encoding_name", &values, &num);
str = (num > 0) ? values[0] : "STRING";
- pub->encoding_name = (char*) Xmalloc(strlen(str) + 1);
+ pub->encoding_name = strdup(str);
if (pub->encoding_name == NULL)
return False;
- strcpy(pub->encoding_name, str);
return True;
}
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++) {