Remove priv arguments from ExprResolveString

They've never been used.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
master
Daniel Stone 2012-02-20 14:15:08 +00:00
parent b7b49eb0f7
commit 26285a7bd9
7 changed files with 32 additions and 58 deletions

View File

@ -985,7 +985,7 @@ HandleActionMessage(struct xkb_desc * xkb,
case F_Data:
if (array_ndx == NULL)
{
if (!ExprResolveString(value, &rtrn, NULL, NULL))
if (!ExprResolveString(value, &rtrn))
return ReportMismatch(action->type, field, "string");
else
{
@ -1190,7 +1190,7 @@ HandlePrivate(struct xkb_desc * xkb,
case F_Data:
if (array_ndx == NULL)
{
if (!ExprResolveString(value, &rtrn, NULL, NULL))
if (!ExprResolveString(value, &rtrn))
return ReportMismatch(action->type, field, "string");
else
{

View File

@ -652,10 +652,8 @@ ExprResolveInteger(ExprDef * expr,
int
ExprResolveString(ExprDef * expr,
ExprResult * val_rtrn,
IdentLookupFunc lookup, char * lookupPriv)
ExprResult * val_rtrn)
{
int ok = 0;
ExprResult leftRtrn, rightRtrn;
ExprDef *left;
ExprDef *right;
@ -675,40 +673,26 @@ ExprResolveString(ExprDef * expr,
val_rtrn->str = strdup("");
return True;
case ExprIdent:
if (lookup)
{
ok = (*lookup) (lookupPriv,
None, expr->value.str, TypeString, val_rtrn);
}
if (!ok)
ERROR("Identifier \"%s\" of type string not found\n",
XkbcAtomText(expr->value.str));
return ok;
ERROR("Identifier \"%s\" of type string not found\n",
XkbcAtomText(expr->value.str));
return False;
case ExprFieldRef:
if (lookup)
{
ok = (*lookup) (lookupPriv,
expr->value.field.element,
expr->value.field.field, TypeString, val_rtrn);
}
if (!ok)
ERROR("Default \"%s.%s\" of type string not found\n",
XkbcAtomText(expr->value.field.element),
XkbcAtomText(expr->value.field.field));
return ok;
ERROR("Default \"%s.%s\" of type string not found\n",
XkbcAtomText(expr->value.field.element),
XkbcAtomText(expr->value.field.field));
return False;
case OpAdd:
left = expr->value.binary.left;
right = expr->value.binary.right;
if (ExprResolveString(left, &leftRtrn, lookup, lookupPriv) &&
ExprResolveString(right, &rightRtrn, lookup, lookupPriv))
if (ExprResolveString(left, &leftRtrn) &&
ExprResolveString(right, &rightRtrn))
{
int len;
char *new;
len = strlen(leftRtrn.str) + strlen(rightRtrn.str) + 1;
new = (char *) malloc(len);
if (new)
{
sprintf(new, "%s%s", leftRtrn.str, rightRtrn.str);
{ sprintf(new, "%s%s", leftRtrn.str, rightRtrn.str);
free(leftRtrn.str);
free(rightRtrn.str);
val_rtrn->str = new;
@ -739,18 +723,10 @@ ExprResolveString(ExprDef * expr,
ERROR("%s of string values not permitted\n", bogus);
return False;
case OpNot:
left = expr->value.child;
if (ExprResolveString(left, &leftRtrn, lookup, lookupPriv))
{
ERROR("The ! operator cannot be applied to a string\n");
}
ERROR("The ! operator cannot be applied to a string\n");
return False;
case OpUnaryPlus:
left = expr->value.child;
if (ExprResolveString(left, &leftRtrn, lookup, lookupPriv))
{
ERROR("The + operator cannot be applied to a string\n");
}
ERROR("The + operator cannot be applied to a string\n");
return False;
default:
WSGO("Unknown operator %d in ResolveString\n", expr->op);

View File

@ -121,9 +121,7 @@ extern int ExprResolveFloat(ExprDef * /* expr */ ,
);
extern int ExprResolveString(ExprDef * /* expr */ ,
ExprResult * /* val_rtrn */ ,
IdentLookupFunc /* lookup */ ,
char * /* lookupPriv */
ExprResult * /* val_rtrn */
);
extern int ExprResolveKeyName(ExprDef * /* expr */ ,

View File

@ -1482,7 +1482,7 @@ SetShapeDoodadField(DoodadInfo * di,
info->errorCount++;
return ReportNotArray(typeName, field, ddText(di));
}
if (!ExprResolveString(value, &tmp, NULL, NULL))
if (!ExprResolveString(value, &tmp))
{
info->errorCount++;
return ReportBadType(typeName, field, ddText(di), "string");
@ -1615,7 +1615,7 @@ SetTextDoodadField(DoodadInfo * di,
}
if (type == FIELD_STRING)
{
if (!ExprResolveString(value, &tmp, NULL, NULL))
if (!ExprResolveString(value, &tmp))
{
info->errorCount++;
return ReportBadType(typeName, field, ddText(di), "string");
@ -1664,7 +1664,7 @@ SetIndicatorDoodadField(DoodadInfo * di,
info->errorCount++;
return ReportNotArray("indicator doodad", field, ddText(di));
}
if (!ExprResolveString(value, &tmp, NULL, NULL))
if (!ExprResolveString(value, &tmp))
{
info->errorCount++;
return ReportBadType("indicator doodad", field,
@ -1740,7 +1740,7 @@ SetLogoDoodadField(DoodadInfo * di,
info->errorCount++;
return ReportNotArray(typeName, field, ddText(di));
}
if (!ExprResolveString(value, &tmp, NULL, NULL))
if (!ExprResolveString(value, &tmp))
{
info->errorCount++;
return ReportBadType(typeName, field, ddText(di), "string");
@ -1758,7 +1758,7 @@ SetLogoDoodadField(DoodadInfo * di,
info->errorCount++;
return ReportNotArray(typeName, field, ddText(di));
}
if (!ExprResolveString(value, &tmp, NULL, NULL))
if (!ExprResolveString(value, &tmp))
{
info->errorCount++;
return ReportBadType(typeName, field, ddText(di),
@ -1842,7 +1842,7 @@ SetDoodadField(DoodadInfo * di,
info->errorCount++;
return ReportNotArray("doodad", field, ddText(di));
}
if (!ExprResolveString(value, &tmp, NULL, NULL))
if (!ExprResolveString(value, &tmp))
{
info->errorCount++;
return ReportBadType("doodad", field, ddText(di), "string");
@ -2044,7 +2044,7 @@ SetKeyField(KeyInfo * key,
info->errorCount++;
return ReportNotArray("key", field, keyText(key));
}
if (!ExprResolveString(value, &tmp, NULL, NULL))
if (!ExprResolveString(value, &tmp))
{
info->errorCount++;
return ReportBadType("key", field, keyText(key), "string");
@ -2061,7 +2061,7 @@ SetKeyField(KeyInfo * key,
info->errorCount++;
return ReportNotArray("key", field, keyText(key));
}
if (!ExprResolveString(value, &tmp, NULL, NULL))
if (!ExprResolveString(value, &tmp))
{
info->errorCount++;
return ReportBadType("key", field, keyText(key), "string");
@ -2104,7 +2104,7 @@ SetGeometryProperty(GeometryInfo * info, char *property, ExprDef * value)
InitPropertyInfo(&pi, info);
pi.name = property;
if (!ExprResolveString(value, &result, NULL, NULL))
if (!ExprResolveString(value, &result))
{
info->errorCount++;
ERROR("Property values must be type string\n");
@ -2307,7 +2307,7 @@ HandleGeometryVar(VarDef * stmt, struct xkb_desc * xkb, GeometryInfo * info)
info->errorCount++;
ret = ReportNotArray("keyboard", field.str, "geometry");
}
if (!ExprResolveString(stmt->value, &tmp, NULL, NULL))
if (!ExprResolveString(stmt->value, &tmp))
{
info->errorCount++;
ret = ReportBadType("keyboard", field.str, "geometry", "string");
@ -2327,7 +2327,7 @@ HandleGeometryVar(VarDef * stmt, struct xkb_desc * xkb, GeometryInfo * info)
info->errorCount++;
ret = ReportNotArray("keyboard", field.str, "geometry");
}
if (!ExprResolveString(stmt->value, &tmp, NULL, NULL))
if (!ExprResolveString(stmt->value, &tmp))
{
info->errorCount++;
ret = ReportBadType("keyboard", field.str, "geometry", "string");
@ -2382,7 +2382,7 @@ HandleGeometryVar(VarDef * stmt, struct xkb_desc * xkb, GeometryInfo * info)
info->errorCount++;
ret = ReportNotArray("keyboard", field.str, "geometry");
}
else if (!ExprResolveString(stmt->value, &tmp, NULL, NULL))
else if (!ExprResolveString(stmt->value, &tmp))
{
info->errorCount++;
ret = ReportBadType("keyboard", field.str, "geometry", "string");

View File

@ -770,7 +770,7 @@ HandleIndicatorNameDef(IndicatorNameDef * def,
}
InitIndicatorNameInfo(&ii, info);
ii.ndx = def->ndx;
if (!ExprResolveString(def->name, &tmp, NULL, NULL))
if (!ExprResolveString(def->name, &tmp))
{
char buf[20];
snprintf(buf, sizeof(buf), "%d", def->ndx);

View File

@ -833,7 +833,7 @@ SetLevelName(KeyTypeInfo * type, ExprDef * arrayNdx, ExprDef * value)
return False;
}
level = rtrn.ival - 1;
if (!ExprResolveString(value, &rtrn, NULL, NULL))
if (!ExprResolveString(value, &rtrn))
{
ERROR("Non-string name for level %d in key type %s\n", level + 1,
XkbcAtomText(type->name));

View File

@ -1131,7 +1131,7 @@ SetSymbolsField(KeyInfo * key,
if (uStrCaseCmp(field, "type") == 0)
{
ExprResult ndx;
if ((!ExprResolveString(value, &tmp, NULL, NULL))
if ((!ExprResolveString(value, &tmp))
&& (warningLevel > 0))
{
WARN("The type field of a key symbol map must be a string\n");
@ -1397,7 +1397,7 @@ SetGroupName(SymbolsInfo * info, ExprDef * arrayNdx, ExprDef * value)
ACTION("Name for group %d ignored\n", tmp.uval);
return False;
}
if (!ExprResolveString(value, &name, NULL, NULL))
if (!ExprResolveString(value, &name))
{
ERROR("Group name must be a string\n");
ACTION("Illegal name for group %d ignored\n", tmp.uval);