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

View File

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

View File

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

View File

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

View File

@ -833,7 +833,7 @@ SetLevelName(KeyTypeInfo * type, ExprDef * arrayNdx, ExprDef * value)
return False; return False;
} }
level = rtrn.ival - 1; 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, ERROR("Non-string name for level %d in key type %s\n", level + 1,
XkbcAtomText(type->name)); XkbcAtomText(type->name));

View File

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