break;
case READ_FUNCTION:
- if (func == NULL) {
- func = memory_pool_alloc (pool, sizeof (struct expression_function));
- }
-
if (*p == '/') {
/* In fact it is regexp */
state = READ_REGEXP;
c ++;
p ++;
} else if (*p == '(') {
+ func = memory_pool_alloc (pool, sizeof (struct expression_function));
func->name = memory_pool_alloc (pool, p - c + 1);
func->args = NULL;
g_strlcpy (func->name, c, (p - c + 1));
optimize_regexp_expression (struct expression **e, GQueue *stack, gboolean res)
{
struct expression *it = *e;
- gboolean ret = FALSE;
+ gboolean ret = FALSE, is_nearest = TRUE;
while (it) {
/* Find first operation for this iterator */
if (it->type == EXPR_OPERATION) {
/* If this operation is just ! just inverse res and check for further operators */
- if (it->content.operation == '!') {
+ if (it->content.operation == '!' && is_nearest) {
res = !res;
it = it->next;
*e = it;
}
break;
}
+ is_nearest = FALSE;
it = it->next;
}