struct pat_ref *pat_ref_newid(int unique_id, const char *display, unsigned int flags);
struct pat_ref_elt *pat_ref_find_elt(struct pat_ref *ref, const char *key);
int pat_ref_append(struct pat_ref *ref, char *pattern, char *sample, int line);
-int pat_ref_add(struct pat_ref *ref, const char *pattern, const char *sample, char **err);
+int pat_ref_add(struct pat_ref *ref, const char *pattern, const char *sample, int patflags, char **err);
int pat_ref_set(struct pat_ref *ref, const char *pattern, const char *sample, char **err);
int pat_ref_set_by_id(struct pat_ref *ref, struct pat_ref_elt *refelt, const char *value, char **err);
int pat_ref_delete(struct pat_ref *ref, const char *key);
/* Add sample to the reference, and try to compile it fior each pattern
* using this value.
*/
- if (!pat_ref_add(ref, arg, NULL, err))
+ if (!pat_ref_add(ref, arg, NULL, patflags, err))
goto out_free_expr;
args++;
}
/* Add value. */
err = NULL;
if (appctx->ctx.map.display_flags == PAT_REF_MAP)
- ret = pat_ref_add(appctx->ctx.map.ref, args[3], args[4], &err);
+ ret = pat_ref_add(appctx->ctx.map.ref, args[3], args[4], 0, &err);
else
- ret = pat_ref_add(appctx->ctx.map.ref, args[3], NULL, &err);
+ ret = pat_ref_add(appctx->ctx.map.ref, args[3], NULL, 0, &err);
if (!ret) {
if (err)
memprintf(&err, "%s.\n", err);
*/
int pat_ref_add(struct pat_ref *ref,
const char *pattern, const char *sample,
- char **err)
+ int patflags, char **err)
{
struct pat_ref_elt *elt;
struct pattern_expr *expr;
LIST_ADDQ(&ref->head, &elt->list);
list_for_each_entry(expr, &ref->pat, list) {
- if (!pat_ref_push(elt, expr, 0, err)) {
+ if (!pat_ref_push(elt, expr, patflags, err)) {
/* If the insertion fails, try to delete all the added entries. */
pat_ref_delete_by_id(ref, elt);
return 0;
/* perform update */
/* add entry only if it does not already exist */
if (pat_ref_find_elt(ref, key) == NULL)
- pat_ref_add(ref, key, NULL, NULL);
+ pat_ref_add(ref, key, NULL, 0, NULL);
break;
}
pat_ref_set(ref, key, value, NULL);
else
/* insert a new entry */
- pat_ref_add(ref, key, value, NULL);
+ pat_ref_add(ref, key, value, 0, NULL);
break;
}
/* perform update */
/* check if the entry already exists */
if (pat_ref_find_elt(ref, key) == NULL)
- pat_ref_add(ref, key, NULL, NULL);
+ pat_ref_add(ref, key, NULL, 0, NULL);
break;
}
pat_ref_set(ref, key, value, NULL);
else
/* insert a new entry */
- pat_ref_add(ref, key, value, NULL);
+ pat_ref_add(ref, key, value, 0, NULL);
break;
}