Exemplo n.º 1
0
/* ---------------- */
void remove_font(int font_nr)
{
register long len;
register unsigned char *fnt_adr;
fontform *fnt;
long *fnt_p;

fnt = fnt_point[akt_id];
fnt_p = (long *)&fnt_point[akt_id];

while(fnt > 0 && fnt[0].id != font_nr)
	{
	fnt_p = (long *)&fnt[0].next;
	fnt = fnt[0].next;
	}

if (fnt <= 0)
	return;

fnt_p[0] = (long)fnt[0].next;

len = *(long *)((long)fnt - 4) + 4;
fnt_adr = (unsigned char *)fnt - 4;

remove_one(fnt_adr, len);
}
Exemplo n.º 2
0
static VALUE
wait_list_cleanup(List *list)
{
    /* cleanup in case of spurious wakeups */
    remove_one(list, rb_thread_current());
    return Qnil;
}
Exemplo n.º 3
0
int main()
{
  static list_t list;
  append_one(&list);
  remove_one(&list);
  
  return 0;
}
int main()
{
    static list_t list;

    int i = 0;
    int y = 0;
    int z = 0;
    int length = 0;

    while (i < 2) {

        while (y < 3 && __VERIFIER_nondet_int()) {
            append_one(&list, rand_end_point());
            y++;
            length++;
        }

        while (z < 3 && __VERIFIER_nondet_int()) {
            remove_one(&list, rand_end_point());
            z++;
            if(length > 0) {
              length--; 
            }
         }
            
         y = 0;
         z = 0;
         i++;
    }

    end_point_t end_point;
    direction_t direction;

    if (__VERIFIER_nondet_int()) {
        /* destroy the list from begin to end */
        end_point = LIST_BEG;
        direction = ITEM_NEXT;
    }
    else {
        /* destroy the list from end to begin */
        end_point = LIST_END;
        direction = ITEM_PREV;
    }

    /* now please destroy the list */
    item_p cursor = list[end_point];

    while (length > 0) {
        item_p next = (*cursor)[direction];
        free(cursor);
        cursor = next;
	length--;
    }

    return 0;
}
Exemplo n.º 5
0
//TODO Find easier and more portable implementation of removing directory recursively.
//     e.g.
void pyi_remove_temp_path(const char *dir)
{
	char fnm[PATH_MAX+1];
	struct _finddata_t finfo;
	intptr_t h;
	size_t dirnmlen;
	strcpy(fnm, dir);
	dirnmlen = strlen(fnm);
	if ( fnm[dirnmlen-1] != '/' && fnm[dirnmlen-1] != '\\' ) {
		strcat(fnm, "\\");
		dirnmlen++;
	}
	strcat(fnm, "*");
	h = _findfirst(fnm, &finfo);
	if (h != -1) {
		remove_one(fnm, dirnmlen, finfo);
		while ( _findnext(h, &finfo) == 0 )
			remove_one(fnm, dirnmlen, finfo);
		_findclose(h);
	}
	rmdir(dir);
}
Exemplo n.º 6
0
int main(void)
{
	setup_locale();
	setup_tmpctx();

	sanity();
	remove_one();
	remove_first();
	remove_last();
	remove_multiple();
	remove_all();
	remove_complex();

	tal_free(tmpctx);
	printf("run-json_remove ok\n");
}
Exemplo n.º 7
0
void pyi_remove_temp_path(const char *dir)
{
	char fnm[PATH_MAX+1];
	DIR *ds;
	struct dirent *finfo;
	int dirnmlen;

	strcpy(fnm, dir);
	dirnmlen = strlen(fnm);
	if ( fnm[dirnmlen-1] != PYI_SEP) {
		strcat(fnm, PYI_SEPSTR);
		dirnmlen++;
	}
	ds = opendir(dir);
	finfo = readdir(ds);
	while (finfo) {
		remove_one(fnm, dirnmlen, finfo->d_name);
		finfo = readdir(ds);
	}
	closedir(ds);
	rmdir(dir);
}
Exemplo n.º 8
0
int main()
{
    static list_t list;

    while (__VERIFIER_nondet_int()) {
        while (__VERIFIER_nondet_int())
            append_one(&list, rand_end_point());

        while (__VERIFIER_nondet_int())
            remove_one(&list, rand_end_point());
    }

    end_point_t end_point;
    direction_t direction;

    if (__VERIFIER_nondet_int()) {
        /* destroy the list from begin to end */
        end_point = LIST_BEG;
        direction = ITEM_NEXT;
    }
    else {
        /* destroy the list from end to begin */
        end_point = LIST_END;
        direction = ITEM_PREV;
    }

    /* now please destroy the list */
    item_p cursor = list[end_point];
    while (cursor) {
        item_p next = (*cursor)[direction];
        free(cursor);
        cursor = next;
    }

    return 0;
}
Exemplo n.º 9
0
int main(int argc, char **argv)
{
	int          tmode, ans_fi, target, fold, knum;
	unsigned int seed;
	int          tflag = 0, eval_time = 0, skip_flag = 0;
	double       ans_value;
	Data         dat;
	FInfo        fs;

	/* 引数の読み込み */
	read_opt(argc, argv, &dat, &fs, SBS, &tmode, &knum, &fold, &seed);

	/* 各分割におけるデータの個数を初期化 */
	dat.split_num = set_split(fold, dat.total);

	/* 配列の初期化 */
	alloc_prm(&dat, &fs);

	/* データの読み込み */
	read_data(&dat);

	/* 実験の初期化 */
	shuffle(&dat, seed);
	skip_flag = init_step(&dat, &fs, &eval_time, INITIAL, fold, knum, SBS);
	
	if(!skip_flag){
		/* SBS開始 */
		while(1){
			/* 
				 Backward Step: 
				 SBSで評価関数の値を最も少なく減少させる特徴を一つ削除する。
				 削除したらFoward Stepへ。 
			*/
			sbs(&dat, &fs, &ans_value, fold, &target, &eval_time, knum);
			ans_fi = target;
			
			/* 最も不要な特徴を除いた特徴集合を作成 */
			remove_one(&fs, target, ans_value);
			
			print_fs(&fs, eval_time, BACKWARD);
			
			/* tmodeモードの時は、最も評価関数の値が大きい特徴集合を保存する */
			if(tmode)
				eval_best(&fs);
			
			if(fs.sel.num == fs.ext_num){
				print_fs(&fs, eval_time, FINAL);
				tflag = 1;
				break;
			}
			
		};  /* 全体のループ */
	}
	
	/* 選択した特徴集合を出力する */
	output(&fs, tmode, eval_time);
	
	/* 確保した配列を解放する */
	free_prm(&dat, &fs);

	exit(0);
}
Exemplo n.º 10
0
void remove_list_wrap(list_wrap* one_wrap)
{
	remove_one(one_wrap->list);
}