X-Git-Url: https://jfr.im/git/irc/quakenet/newserv.git/blobdiff_plain/798a53a27e24f354d6ec78317467b998302cd0b0..cd9baaa220c4afdfbbb25d4c4f6c8aa1f02fe637:/newsearch/ns-lt.c diff --git a/newsearch/ns-lt.c b/newsearch/ns-lt.c index d15c585b..7bed1fb2 100644 --- a/newsearch/ns-lt.c +++ b/newsearch/ns-lt.c @@ -14,10 +14,10 @@ struct lt_localdata { struct searchNode **nodes; }; -void lt_free(struct searchNode *thenode); -void *lt_exe(struct searchNode *thenode, void *theinput); +void lt_free(searchCtx *ctx, struct searchNode *thenode); +void *lt_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput); -struct searchNode *lt_parse(int type, int argc, char **argv) { +struct searchNode *lt_parse(searchCtx *ctx, int argc, char **argv) { struct lt_localdata *localdata; struct searchNode *thenode; int i; @@ -49,15 +49,15 @@ struct searchNode *lt_parse(int type, int argc, char **argv) { for (i=0;inodes[i] = search_parse(type, argv[i]); + localdata->nodes[i] = ctx->parser(ctx, 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]) { - lt_free(thenode); + lt_free(ctx, thenode); return NULL; } @@ -72,7 +72,7 @@ struct searchNode *lt_parse(int type, int argc, char **argv) { return thenode; } -void lt_free(struct searchNode *thenode) { +void lt_free(searchCtx *ctx, struct searchNode *thenode) { struct lt_localdata *localdata; int i; @@ -80,7 +80,7 @@ void lt_free(struct searchNode *thenode) { for (i=0;icount;i++) { if (localdata->nodes[i]) - (localdata->nodes[i]->free)(localdata->nodes[i]); + (localdata->nodes[i]->free)(ctx, localdata->nodes[i]); } free(localdata->nodes); @@ -88,7 +88,7 @@ void lt_free(struct searchNode *thenode) { free(thenode); } -void *lt_exe(struct searchNode *thenode, void *theinput) { +void *lt_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) { int i; char *strval; int intval; @@ -102,17 +102,17 @@ void *lt_exe(struct searchNode *thenode, void *theinput) { switch (localdata->type) { case RETURNTYPE_INT: 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;icount;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_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;icount;i++) { - if (ircd_strcmp(strval, (char *)(localdata->nodes[i]->exe)(localdata->nodes[i], theinput)) >= 0) + if (ircd_strcmp(strval, (char *)(localdata->nodes[i]->exe)(ctx, localdata->nodes[i], theinput)) >= 0) return (void *)0; } return (void *)1;