Example #1
0
ib_status_t ib_capture_clear(ib_field_t *capture)
{
    assert(capture != NULL);

    ib_status_t rc;
    ib_list_t *list;

    rc = get_capture_list(capture, &list);
    if (rc != IB_OK) {
        return rc;
    }
    ib_list_clear(list);
    return IB_OK;
}
Example #2
0
ib_status_t ib_flags_oplist_parse(
    const ib_strval_t *map,
    ib_mpool_t        *mp,
    const char        *str,
    const char        *sep,
    ib_list_t         *oplist)
{
    if ( (map == NULL) || (str == NULL) || (sep == NULL) || (oplist == NULL) ) {
        return IB_EINVAL;
    }

    char       *copy;
    const char *tmp;

    /* Make a copy of the string that we can use for strtok */
    copy = ib_mpool_strdup(mp, str);
    if (copy == NULL) {
        return IB_EALLOC;
    }

    /* Clear the list */
    ib_list_clear(oplist);

    /* Walk through the separated list, parser each operator, build the list */
    tmp = strtok(copy, sep);
    do {
        ib_status_t           rc;
        ib_flags_op_t         op;
        ib_flags_t            flags;
        ib_flags_operation_t *operation;

        rc = parse_single(map, tmp, &op, &flags);
        if (rc != IB_OK) {
            return rc;
        }
        operation = ib_mpool_alloc(mp, sizeof(*operation));
        if (operation == NULL) {
            return IB_EALLOC;
        }
        operation->op = op;
        operation->flags = flags;
        rc = ib_list_push(oplist, operation);
        if (rc != IB_OK) {
            return rc;
        }
    } while ( (tmp = strtok(NULL, sep)) != NULL);

    return IB_OK;
}
Example #3
0
 //! Clear list.
 void clear() const
 {
     ib_list_clear(m_ib);
 }