Beispiel #1
0
char *correct_str(correction_t *corr, correct_trie_t* table, const char *ident) {
    char **e1      = NULL;
    char **e2      = NULL;
    char  *e1ident = NULL;
    char  *e2ident = NULL;
    size_t e1rows  = 0;
    size_t e2rows  = 0;
    size_t *bits   = NULL;

    /* needs to be allocated for free later */
    if (correct_find(table, ident))
        return correct_pool_claim(ident);

    if ((e1rows = correct_size(ident))) {
        if (vec_size(corr->edits) > 0)
            e1 = corr->edits[0];
        else {
            e1 = correct_edit(ident, &bits);
            vec_push(corr->edits, e1);
            vec_push(corr->lens,  bits);
        }

        if ((e1ident = correct_maximum(table, e1, e1rows)))
            return correct_pool_claim(e1ident);
    }

    e2 = correct_known(corr, table, e1, e1rows, &e2rows);
    if (e2rows && ((e2ident = correct_maximum(table, e2, e2rows))))
        return correct_pool_claim(e2ident);


    return util_strdup(ident);
}
Beispiel #2
0
static void cwin_size(WScreen *scr, int *w, int *h, XSizeHints *sh)
{
	correct_size(w, h, sh, FALSE);
	
	if(sh->flags&PBaseSize){
		*w-=sh->base_width;
		*h-=sh->base_height;
	}
	
	if(sh->flags&PResizeInc){
		*w/=sh->width_inc;
		*h/=sh->height_inc;
	}else{
		*w/=scr->w_unit;
		*h/=scr->h_unit;
	}
}