int i, idx;
struct proxy *px;
struct userlist *ul;
+ struct my_regex *reg;
const char *msg = NULL;
- char *sname, *pname;
+ char *sname, *pname, *err = NULL;
idx = 0;
min_arg = ARGM(mask);
argp[idx].type = ARGT_MSK6;
break;
+ case ARGT_REG:
+ if (argp[idx].type != ARGT_STR) {
+ msg = "string expected";
+ goto error;
+ }
+ reg = regex_comp(argp[idx].data.str.area, !(argp[idx].type_flags & ARGF_REG_ICASE), 1, &err);
+ if (!reg) {
+ msg = lua_pushfstring(L, "error compiling regex '%s' : '%s'",
+ argp[idx].data.str.area, err);
+ free(err);
+ goto error;
+ }
+ argp[idx].type = ARGT_REG;
+ argp[idx].data.reg = reg;
+ break;
+
case ARGT_USR:
if (argp[idx].type != ARGT_STR) {
msg = "string expected";
break;
case ARGT_MAP:
- case ARGT_REG:
msg = "type not yet supported";
goto error;
break;
for (i = 0; i < idx; i++) {
if (argp[i].type == ARGT_STR)
chunk_destroy(&argp[i].data.str);
+ else if (argp[i].type == ARGT_REG)
+ regex_free(argp[i].data.reg);
}
WILL_LJMP(luaL_argerror(L, first + idx, msg));
return 0; /* Never reached */
for (i = 0; args[i].type != ARGT_STOP; i++) {
if (args[i].type == ARGT_STR)
chunk_destroy(&args[i].data.str);
+ else if (args[i].type == ARGT_REG)
+ regex_free(args[i].data.reg);
}
return 1;
for (i = 0; args[i].type != ARGT_STOP; i++) {
if (args[i].type == ARGT_STR)
chunk_destroy(&args[i].data.str);
+ else if (args[i].type == ARGT_REG)
+ regex_free(args[i].data.reg);
}
WILL_LJMP(lua_error(L));
return 0; /* Never reached */
for (i = 0; args[i].type != ARGT_STOP; i++) {
if (args[i].type == ARGT_STR)
chunk_destroy(&args[i].data.str);
+ else if (args[i].type == ARGT_REG)
+ regex_free(args[i].data.reg);
}
return 1;
for (i = 0; args[i].type != ARGT_STOP; i++) {
if (args[i].type == ARGT_STR)
chunk_destroy(&args[i].data.str);
+ else if (args[i].type == ARGT_REG)
+ regex_free(args[i].data.reg);
}
WILL_LJMP(lua_error(L));
return 0; /* Never reached */