Require strdup and remove utils wrapper

This kills a couple warnings from using the uStringDup wrapper. If you
don't have strdup on your platform, you have bigger issues.
master
Dan Nicholson 2009-04-05 20:27:35 -07:00
parent 8b100fc0a9
commit 5889cef809
13 changed files with 22 additions and 42 deletions

View File

@ -54,7 +54,7 @@ if test "x$CC_FOR_BUILD" = x; then
fi
fi
AC_CHECK_FUNCS([strdup strcasecmp])
AC_CHECK_FUNCS([strcasecmp])
XORG_CHECK_MALLOC_ZERO
XORG_CWARNFLAGS

View File

@ -718,7 +718,7 @@ HandleCompatMapFile(XkbFile * file,
if (merge == MergeDefault)
merge = MergeAugment;
info->name = uStringDup(file->name);
info->name = _XkbDupString(file->name);
stmt = file->defs;
while (stmt)
{

View File

@ -752,7 +752,7 @@ AddProperty(GeometryInfo * info, PropertyInfo * new)
}
if (old->value)
uFree(old->value);
old->value = uStringDup(new->value);
old->value = _XkbDupString(new->value);
return True;
}
if (((old->defs.fileID == new->defs.fileID) && (warningLevel > 0))
@ -768,8 +768,8 @@ AddProperty(GeometryInfo * info, PropertyInfo * new)
if ((new = NextProperty(info)) == NULL)
return False;
new->defs.next = NULL;
new->name = uStringDup(old->name);
new->value = uStringDup(old->value);
new->name = _XkbDupString(old->name);
new->value = _XkbDupString(old->value);
return True;
}
@ -1761,7 +1761,7 @@ SetLogoDoodadField(DoodadInfo * di,
return ReportBadType(typeName, field, ddText(di),
"string");
}
di->logoName = uStringDup(tmp.str);
di->logoName = _XkbDupString(tmp.str);
return True;
}
return ReportBadField(typeName, field, ddText(di));
@ -2805,7 +2805,7 @@ HandleGeometryFile(XkbFile * file,
if (merge == MergeDefault)
merge = MergeAugment;
info->name = uStringDup(file->name);
info->name = _XkbDupString(file->name);
stmt = file->defs;
while (stmt)
{
@ -3632,7 +3632,7 @@ CompileGeometry(XkbFile *file, XkbcDescPtr xkb, unsigned merge)
}
if (info.fontSpec != None)
geom->label_font =
uStringDup(XkbcAtomGetString(info.fontSpec));
_XkbDupString(XkbcAtomGetString(info.fontSpec));
else
geom->label_font = FontFromParts(info.font, info.fontWeight,
info.fontSlant,

View File

@ -753,7 +753,7 @@ HandleKeycodesFile(XkbFile * file,
{
ParseCommon *stmt;
info->name = uStringDup(file->name);
info->name = _XkbDupString(file->name);
stmt = file->defs;
while (stmt)
{

View File

@ -131,7 +131,7 @@ InitKeyTypesInfo(KeyTypesInfo * info, XkbcDescPtr xkb, KeyTypesInfo * from)
tok_TWO_LEVEL = XkbcInternAtom("TWO_LEVEL", False);
tok_ALPHABETIC = XkbcInternAtom("ALPHABETIC", False);
tok_KEYPAD = XkbcInternAtom("KEYPAD", False);
info->name = uStringDup("default");
info->name = strdup("default");
info->errorCount = 0;
info->stdPresent = 0;
info->nTypes = 0;
@ -1066,7 +1066,7 @@ HandleKeyTypesFile(XkbFile * file,
{
ParseCommon *stmt;
info->name = uStringDup(file->name);
info->name = _XkbDupString(file->name);
stmt = file->defs;
while (stmt)
{

View File

@ -657,7 +657,7 @@ IncludeCreate(char *str, unsigned merge)
incl = first = NULL;
file = map = NULL;
tmp = str;
stmt = uStringDup(str);
stmt = _XkbDupString(str);
while ((tmp) && (*tmp))
{
if (XkbParseIncludeMap(&tmp, &file, &map, &nextop, &extra_data))
@ -812,7 +812,7 @@ CreateXKBFile(int type, char *name, ParseCommon * defs, unsigned flags)
XkbcEnsureSafeMapName(name);
bzero(file, sizeof(XkbFile));
file->type = type;
file->topName = uStringDup(name);
file->topName = _XkbDupString(name);
file->name = name;
file->defs = defs;
file->id = fileID++;

View File

@ -1637,7 +1637,7 @@ HandleSymbolsFile(XkbFile * file,
{
ParseCommon *stmt;
info->name = uStringDup(file->name);
info->name = _XkbDupString(file->name);
stmt = file->defs;
while (stmt)
{

View File

@ -397,20 +397,6 @@ uFinishUp(void)
/***====================================================================***/
#ifndef HAVE_STRDUP
char *
uStringDup(const char *str)
{
char *rtrn;
if (str == NULL)
return NULL;
rtrn = (char *) uAlloc(strlen(str) + 1);
strcpy(rtrn, str);
return rtrn;
}
#endif
#ifndef HAVE_STRCASECMP
int
uStrCaseCmp(const char *str1, const char *str2)

View File

@ -174,12 +174,6 @@ uStrCaseCmp(const char *s1, const char *s2);
extern int
uStrCasePrefix(const char *p, char *str);
#endif
#ifdef HAVE_STRDUP
#define uStringDup(s1) ((s1) ? strdup(s1) : NULL)
#else
extern char *
uStringDup(const char *s);
#endif
/***====================================================================***/

View File

@ -27,7 +27,6 @@ authorization from the authors.
#include <limits.h>
#include "X11/extensions/XKBcommon.h"
#include <X11/extensions/XKM.h>
#include "XKBcommonint.h"
#include "xkbcomp.h"
#include "parseutils.h"
#include "utils.h"

View File

@ -38,6 +38,7 @@
#include <X11/extensions/XKM.h>
#include "X11/extensions/XKBcommon.h"
#include "XKBcommonint.h"
extern char *scanFile;

View File

@ -115,7 +115,7 @@ XkbParseIncludeMap(char **str_inout, char **file_rtrn, char **map_rtrn,
if (tmp != NULL)
{
*tmp++ = '\0';
*extra_data = uStringDup(tmp);
*extra_data = _XkbDupString(tmp);
}
else
{
@ -124,7 +124,7 @@ XkbParseIncludeMap(char **str_inout, char **file_rtrn, char **map_rtrn,
tmp = strchr(str, '(');
if (tmp == NULL)
{
*file_rtrn = uStringDup(str);
*file_rtrn = _XkbDupString(str);
*map_rtrn = NULL;
}
else if (str[0] == '(')
@ -135,7 +135,7 @@ XkbParseIncludeMap(char **str_inout, char **file_rtrn, char **map_rtrn,
else
{
*tmp++ = '\0';
*file_rtrn = uStringDup(str);
*file_rtrn = _XkbDupString(str);
str = tmp;
tmp = strchr(str, ')');
if ((tmp == NULL) || (tmp[1] != '\0'))
@ -145,7 +145,7 @@ XkbParseIncludeMap(char **str_inout, char **file_rtrn, char **map_rtrn,
return False;
}
*tmp++ = '\0';
*map_rtrn = uStringDup(str);
*map_rtrn = _XkbDupString(str);
}
}
if (*nextop_rtrn == '\0')

View File

@ -353,7 +353,7 @@ yyGetString(void)
buf[nInBuf++] = '\0';
if (scanStr)
uFree(scanStr);
scanStr = (char *) uStringDup(buf);
scanStr = strdup(buf);
scanStrLine = lineNum;
return STRING;
}
@ -434,7 +434,7 @@ yyGetKeyName(void)
buf[nInBuf++] = '\0';
if (scanStr)
uFree(scanStr);
scanStr = (char *) uStringDup(buf);
scanStr = strdup(buf);
scanStrLine = lineNum;
return KEYNAME;
}
@ -568,7 +568,7 @@ yyGetIdent(int first)
{
if (scanStr)
uFree(scanStr);
scanStr = (char *) uStringDup(buf);
scanStr = strdup(buf);
scanStrLine = lineNum;
rtrn = IDENT;
}