Esempio n. 1
0
/* Callback from scheduler that actually does the work for ONE group */
static void* scheduler_cb(void *gfp)
{
    /* cast from *void */
    file_group *group = gfp;
    if(group == NULL || group->grp_stp == NULL)
    {
        return NULL;
    }
    /* do the fingerprint filter */
    group_filter(group);
    /* Kick empty groups, or groups with 1 elem */
    if(group->grp_stp == NULL || group->len <= 1)
    {
        list_clear(group->grp_stp);
        group->grp_stp = NULL;
        group->grp_enp = NULL;
        return NULL;
    }
    /* build checksum for the rest */
    build_checksums(group);
    /* Finalize and free sublist */
    if(findmatches(group))
    {
        /* this happens when 'q' was selected in askmode */
        list_clear(group->grp_stp);
        group->grp_stp = NULL;
        group->grp_enp = NULL;
        die(0);
    }
    list_clear(group->grp_stp);
    return NULL;
}
Esempio n. 2
0
File: flowy.c Progetto: josch/flowy2
static void *branch_start(void *arg)
{
    struct branch_info *binfo = (struct branch_info *)arg;

    struct group **groups;
    struct group **filtered_groups;
    char **filtered_records;
    size_t num_filtered_records;
    size_t num_groups;
    size_t num_filtered_groups;

    /*
     * FILTER
     */

    filtered_records = filter(binfo->data, binfo->filter_rules, binfo->num_filter_rules, &num_filtered_records);
    printf("\rnumber of filtered records: %zd\n", num_filtered_records);

    /*
     * GROUPER
     */

    groups = grouper(filtered_records, num_filtered_records, binfo->group_modules, binfo->num_group_modules, binfo->aggr, binfo->num_aggr, &num_groups);
    free(filtered_records);
    printf("\rnumber of groups: %zd\n", num_groups);

    /*
     * GROUPFILTER
     */

    filtered_groups = group_filter(groups, num_groups, binfo->gfilter_rules, binfo->num_gfilter_rules, &num_filtered_groups);
    free(groups);
    printf("\rnumber of filtered groups: %zd\n", num_filtered_groups);

    pthread_exit(filtered_groups);
}