struct searchNode **nodes;
};
-void eq_free(struct searchNode *thenode);
-void *eq_exe(struct searchNode *thenode, void *theinput);
+void eq_free(searchCtx *ctx, struct searchNode *thenode);
+void *eq_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
-struct searchNode *eq_parse(int type, int argc, char **argv) {
+struct searchNode *eq_parse(searchCtx *ctx, int type, int argc, char **argv) {
struct eq_localdata *localdata;
struct searchNode *thenode;
int i;
for (i=0;i<argc;i++) {
/* Parse the node.. */
- localdata->nodes[i] = search_parse(type, argv[i]);
+ localdata->nodes[i] = ctx->parser(ctx, type, argv[i]);
/* Subsequent nodes get coerced to match the type of the first node */
if (i)
- localdata->nodes[i]=coerceNode(localdata->nodes[i],localdata->type);
+ localdata->nodes[i]=coerceNode(ctx,localdata->nodes[i],localdata->type);
/* If a node didn't parse, give up */
if (!localdata->nodes[i]) {
- eq_free(thenode);
+ eq_free(ctx, thenode);
return NULL;
}
return thenode;
}
-void eq_free(struct searchNode *thenode) {
+void eq_free(searchCtx *ctx, struct searchNode *thenode) {
struct eq_localdata *localdata;
int i;
for (i=0;i<localdata->count;i++) {
if (localdata->nodes[i])
- (localdata->nodes[i]->free)(localdata->nodes[i]);
+ (localdata->nodes[i]->free)(ctx, localdata->nodes[i]);
}
free(localdata->nodes);
free(thenode);
}
-void *eq_exe(struct searchNode *thenode, void *theinput) {
+void *eq_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
int i;
char *strval;
int intval;
switch (localdata->type) {
case RETURNTYPE_INT:
- intval = (int)((long)(localdata->nodes[0]->exe)(localdata->nodes[0], theinput));
+ intval = (int)((long)(localdata->nodes[0]->exe)(ctx, localdata->nodes[0], theinput));
for (i=1;i<localdata->count;i++) {
- if ((int)((long)(localdata->nodes[i]->exe)(localdata->nodes[i], theinput) != intval))
+ if ((int)((long)(localdata->nodes[i]->exe)(ctx, localdata->nodes[i], theinput) != intval))
return (void *)0;
}
return (void *)1;
case RETURNTYPE_BOOL:
- intval = (int)((long)(localdata->nodes[0]->exe)(localdata->nodes[0], theinput));
+ intval = (int)((long)(localdata->nodes[0]->exe)(ctx, localdata->nodes[0], theinput));
for (i=1;i<localdata->count;i++) {
- rval=(int)((long)(localdata->nodes[i]->exe)(localdata->nodes[i], theinput));
+ rval=(int)((long)(localdata->nodes[i]->exe)(ctx, localdata->nodes[i], theinput));
if ((rval && !intval) || (!rval && intval)) { /* LOGICAL XOR GOES HERE FS */
return (void *)0;
}
return (void *)1;
case RETURNTYPE_STRING:
- strval = (char *)(localdata->nodes[0]->exe)(localdata->nodes[0], theinput);
+ strval = (char *)(localdata->nodes[0]->exe)(ctx, localdata->nodes[0], theinput);
for (i=1;i<localdata->count;i++) {
- if (ircd_strcmp(strval, (char *)(localdata->nodes[i]->exe)(localdata->nodes[i], theinput)))
+ if (ircd_strcmp(strval, (char *)(localdata->nodes[i]->exe)(ctx, localdata->nodes[i], theinput)))
return (void *)0;
}
return (void *)1;