mirror of
https://gitlab.freedesktop.org/xorg/lib/libx11.git
synced 2026-05-09 04:58:06 +02:00
Convert malloc(strlen()); strcpy() sets to strdup
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
This commit is contained in:
parent
09194042d3
commit
b850adbdeb
15 changed files with 59 additions and 130 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -661,10 +658,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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -685,11 +680,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;
|
||||
|
|
@ -723,11 +717,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 */
|
||||
}
|
||||
|
|
@ -946,12 +939,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
|
||||
|
|
@ -996,11 +986,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;
|
||||
}
|
||||
|
||||
|
|
@ -1192,11 +1180,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);
|
||||
|
|
@ -1223,11 +1210,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;
|
||||
|
|
@ -1237,11 +1223,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);
|
||||
|
|
@ -1850,16 +1835,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++) {
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -423,10 +423,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;
|
||||
}
|
||||
}
|
||||
|
|
@ -579,8 +576,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;
|
||||
}
|
||||
|
|
@ -729,8 +725,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;
|
||||
}
|
||||
|
|
@ -828,8 +823,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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue