示例#1
0
文件: link_sort.c 项目: kcoewoys/work
int main(void)
{
      link_plist l;

      init_linklist(&l);
      create_linklist(l); //创建链表
      show_linklist(l);   //显示未排序的链表
      link_sort(l);   //对链表排序
      show_linklist(l);  //显示已排好序的链表
      return 0;
}
int Stil_SetOutfilename(char *filename) {
	fname=malloc(strlen(filename) + 1);
	strcpy(fname, filename);

	stil_out = fopen(fname, "w") ;
	if (stil_out == 0) {
		free(fname);
		return 1;
	}
	init_linklist(&initial_comments);
	return 0;
}
示例#3
0
static void init_lists(HWND hdlg, ps_struct_t *ps_struct)
{
    DWORD pastes_added = init_pastelist(hdlg, ps_struct->ps);
    DWORD links_added = init_linklist(hdlg, ps_struct->ps);
    UINT check_id, list_id;

    if((ps_struct->flags & (PSF_SELECTPASTE | PSF_SELECTPASTELINK)) == 0)
        ps_struct->flags |= PSF_SELECTPASTE;

    if(!pastes_added && !links_added)
        ps_struct->flags &= ~(PSF_SELECTPASTE | PSF_SELECTPASTELINK);
    else if(!pastes_added && (ps_struct->flags & PSF_SELECTPASTE))
    {
        ps_struct->flags &= ~PSF_SELECTPASTE;
        ps_struct->flags |= PSF_SELECTPASTELINK;
    }
    else if(!links_added && (ps_struct->flags & PSF_SELECTPASTELINK))
    {
        ps_struct->flags &= ~PSF_SELECTPASTELINK;
        ps_struct->flags |= PSF_SELECTPASTE;
    }

    check_id = 0;
    list_id = 0;
    if(ps_struct->flags & PSF_SELECTPASTE)
    {
        check_id = IDC_PS_PASTE;
        list_id = IDC_PS_PASTELIST;
    }
    else if(ps_struct->flags & PSF_SELECTPASTELINK)
    {
        check_id = IDC_PS_PASTELINK;
        list_id = IDC_PS_PASTELINKLIST;
    }

    CheckRadioButton(hdlg, IDC_PS_PASTE, IDC_PS_PASTELINK, check_id);

    if(list_id)
        update_display_list(hdlg, list_id);
    else
        EnableWindow(GetDlgItem(hdlg, IDOK), 0);
}
示例#4
0
/**
 * Return the rscntxt_t by default value
 */
rscntxt_t* default_context()
{
	rscntxt_t *cntxt = (rscntxt_t *)calloc(sizeof(*cntxt), 1);
	if (NULL == cntxt) {
		return NULL;
	}

	cntxt->conn_list = init_linklist();
	if (NULL == cntxt->conn_list) {
		LogE("Failed init conn_list");
		free (cntxt);
		cntxt = NULL;
		return NULL;
	}

	cntxt->port = DEFAULT_PORT;
	cntxt->backlog = DEFAULT_BACKLOG;
	cntxt->heartbeat_cycle = HEART_BEAT_CYCLE;
	cntxt->min_token = 400;
	cntxt->curr_max_token = 400;

	return cntxt;
}