コード例 #1
0
ファイル: binarytree.c プロジェクト: icidicf/algorithm
void destory(link t)
{
    if (!t)
        return ;

    destory(t->l);
    destory(t->r);
    free(t);
}
コード例 #2
0
ファイル: GList.cpp プロジェクト: abtree1/cppbase
void gList::destory(GL *p){
	if(p->child!=NULL)
	{
		destory(p->child);
	}
	if(p->next!=NULL){
		destory(p->next);
	}
	delete p;
}
コード例 #3
0
ファイル: rbtree.c プロジェクト: OpenZYK/clientsharding
void destory(RBTree *rbTree){
	
	RBTreeNode *currentNode=*rbTree;

	if(currentNode != NULL){	
		destory(&(currentNode->left));
		destory(&(currentNode->right));
		free(currentNode->data);
		free(currentNode);
	}
}
コード例 #4
0
ファイル: polynomial.cpp プロジェクト: Lw-Cui/polynomial
polynomial &polynomial::operator=(const polynomial &p) {
	if (&p == this)
		return *this;

	destory(beg);
	destory(spare);

	spare = newspace();
	end = beg = getunit(0, -INF);
	for (unit *p1 = p.beg; p1 != NULL; p1 = p1->next)
		if (p1->exp != -INF)
			append(p1->coe, p1->exp);
}
コード例 #5
0
bool xGL2RenderTarget::create(ID3D10Resource* pTexture , xGL2TexInfo& TexInfo, int iSlice , int mipLevel )
{
	if(m_pRenderTargetView && m_arraySlice == iSlice && m_mipLevel == mipLevel )
		return true;
	destory();
	m_arraySlice = iSlice;
	m_mipLevel   = mipLevel;

	XSAFE_RELEASE(m_pRenderTargetView);   
	m_pRenderTargetView = NULL;

	GL2_RENDER_TARGET_VIEW_DESC rtDesc;
	rtDesc.Format = TexInfo.m_RTViewFmt;

	if(TexInfo.m_ArraySize > 1)
	{
		rtDesc.Texture2DArray.MipSlice = 0;
		rtDesc.Texture2DArray.FirstArraySlice = 0;
		rtDesc.Texture2DArray.ArraySize       = (UINT)TexInfo.m_ArraySize;
		rtDesc.ViewDimension = GL2_RTV_DIMENSION_TEXTURE2DARRAY;
	}
	else if(TexInfo.m_ArraySize == 1)
	{
		rtDesc.ViewDimension = GL2_RTV_DIMENSION_TEXTURE2D;
		rtDesc.Texture2D.MipSlice = 0;
	}

	m_pGL2Api->d10Device()->CreateRenderTargetView( pTexture, &rtDesc, &m_pRenderTargetView );
	return m_pRenderTargetView != NULL;
}
コード例 #6
0
		virtual void join()
		{
			_done = true;

			destory();

			__super::join();
		}
コード例 #7
0
ファイル: vector.hpp プロジェクト: 1050676515/zpublic
 void RemoveAll()
 {
     for(int i = 0; i < m_Size; i++)
         destory(&m_mem.Get()[i]);
     m_mem.Release();
     m_Size = 0;
     m_SizeAlloc = 0;
 }
コード例 #8
0
ファイル: cd_user_md.cpp プロジェクト: ddslot-pp2/pay2.io
void cd_user_md::kick_user(long long uid) {
  std::lock_guard<std::mutex> lock(m);
  auto user_ptr = get_user(uid);
  if(user_ptr) {
    server_->send_close(user_ptr->connection_, 2);
    user_ptr->destory();
  }
}
コード例 #9
0
ファイル: lua_tinker.cpp プロジェクト: yanwei1983/luatinkerE
		void lua_ref_base::dec_ref()
		{
			if (m_pRef)
			{
				if (--(*m_pRef) == 0)
					destory();
			}
		}
コード例 #10
0
ファイル: main.cpp プロジェクト: ggKM/TankWar
int main()
{

	system("color f0");
	shuoming();
    
    short cuo=0;
    node *tou1=NULL,*tou2=NULL,* result=NULL;
    while(1)
	{  
		do
		{
			cout<<"请选择功能:"<<endl;
			cin>>yunsuan;
			if(!cin)
			{
				cout<<"您输入的不是数字,请重新运行程序"<<endl;
			    exit(0);
			}//if
			switch(yunsuan)
			{
			     case 1:cuo=0;jia(tou1,tou2,result);break;
		         case 2:cuo=0;jian(tou1,tou2,result);break;
	    	     case 3:cuo=0;cheng(tou1,tou2,result);break;
	             case 4:cuo=0;jifen(tou1,result);break;
			     case 5:cuo=0;weifen(tou1,result);break;
		         case 6:cuo=0;qiuzhi(tou1,result);break;
                 case 7:cuo=0;init(tou1);cout<<"输入各项:"<<endl;cout<<"y="<<endl;fuzhi(tou1);outxu(tou1,result);break;
				 default:cuo=1;cout<<"超出功能选择范围,请重新选择:"<<endl;
			}//switch
			
		} while(cuo==1);//do
        
		out(result);
		destory(tou1);destory(tou2);destory(result);
	
		short i=0;
		cout<<"是否清屏(1:是)(0:否):";
		cin>>i;
		if(i==1) {system("cls");shuoming();}
		else     cout<<"*********************"<<endl;
	    
	}//while
    return 0;
}
コード例 #11
0
ファイル: Bullet.cpp プロジェクト: houzisbw/ShootingGame
void Bullet::move()
{
	this->setPositionY(this->getPositionY() + vy);
	Size size = Director::getInstance()->getVisibleSize();

	if (this->getPositionY() >= size.height + this->getContentSize().height / 2)
	{
		destory();//移除飞出屏幕的子弹
	}
}
コード例 #12
0
ファイル: search-bfs.c プロジェクト: HackLinux/C-program
int main(void)
{
	search_bfs(a[0]);
	head = 0;
	while(qc > 0)
		putchar(outqueue());
		putchar('\n');
		destory();
		return 0;
}
コード例 #13
0
ファイル: hui_hulua.cpp プロジェクト: dragon101788/hui5-hulua
int LUA::run()
{
  while(1)
  {
      SPNode ptr = q.getele();
      lock();
      ptr->DO(L);
      unlock();
  }
  destory();
}
コード例 #14
0
ファイル: main.c プロジェクト: jedichou/jedichou-study-cpp
int main(void)
{
	int i;
	for (i=0; i<100; i++)
		if (insert(i) == -1)
			exit(1);
	print();
	destory();
	
	return 0;
}
コード例 #15
0
ファイル: TL_Mysql.cpp プロジェクト: everpan/tidp
TL_Mysql::TL_MysqlRes & TL_Mysql::TL_MysqlRes::operator=(
        const TL_Mysql::TL_MysqlRes & res) {
    destory();
    _result = res._result;
    ++res._counter;
    _counter = 1;
    _fields_num = res._fields_num;
    _rows_num = res._rows_num;
    _field_no = res._field_no;
    return *this;
}
コード例 #16
0
ファイル: GWater.cpp プロジェクト: minuowa/Content
void GQuakePointManager::recreate ( CXIndex cnt , float angVelocity )
{
	destory();

	for ( CXIndex i = 0; i < cnt; ++i )
	{
		QuakePoint* quake = new QuakePoint;
		quake->init ( gRandom.randF ( mMinX, mMaxX ), gRandom.randF ( mMinZ, mMaxZ ), 30, angVelocity, timeGetTime() );
		addPoint ( quake );
	}
}
コード例 #17
0
ファイル: rb_tree.c プロジェクト: PhamNuwen/my-playground
void rb_destory_subtree(rb_node__t *node, void destory(void * item))
{
   if (node == NULL)
      return;

   rb_destory_subtree(node->left, destory);
   rb_destory_subtree(node->right, destory);

   destory(node->item);
   free(node);

}
コード例 #18
0
bool xGL2DepthBuffer::create(ID3D10Resource* pTexture , xGL2TexInfo& TexInfo)
{
    destory();
	ID3D10Device* pDevice = m_pGL2Api->d10Device();
	//创建深度缓冲
	GL2_DEPTH_STENCIL_VIEW_DESC descDSV;
	descDSV.Format = TexInfo.m_RTViewFmt;
	descDSV.ViewDimension = GL2_DSV_DIMENSION_TEXTURE2D;
	descDSV.Texture2D.MipSlice = 0;
	HRESULT hr = pDevice->CreateDepthStencilView( pTexture, &descDSV, &m_pDepthView );
	return !FAILED(hr);
}
コード例 #19
0
ファイル: cgi.c プロジェクト: skyformat99/cgi
int main (){
    while (FCGI_Accept() >= 0) {
        printf("Content-type: text/html;charset=utf-8\r\n");

        cgiInit();
        
        run();

        destory();
    }
    return 0;
}
コード例 #20
0
ファイル: main.c プロジェクト: bcho/homework
int main()
{
    list_t a = make_ascending_list(5);
    insert('z', header(a));
    list_t b = make_ascending_list(12);
    traversal(print_node, a);
    sep;
    traversal(print_node, b);
    sep;
    list_t u = list_union(a, b);
    traversal(print_node, u);
    sep;
    list_t i = list_intersection(a, b);
    traversal(print_node, i);
    
    destory(a);
    destory(b);
    destory(u);
    destory(i);

    return 0;
}
コード例 #21
0
ファイル: chatClient.c プロジェクト: fsxchen/CppStudy
int main() {
    fd = initSocket();
    if(fd == -1) printf("socket err:%m\n"), exit(-1);
    printf("网络初始化成功!\n");
    initUI();
    signal(SIGCHLD, handle);
    if(fork()) {    //父进程
        //输入,发送
        char buf[256];
        while(1) {
            mvwgetstr(wmsg, 1, 1, buf);
            r = send(fd, buf, strlen(buf), 0);
            // wclear(wmsg);
            // box(wmsg, 0, 0);
            refresh();
            wrefresh(wmsg);
            wrefresh(winfo);

        }

    } else {
        //接收显示
        char buf[256];
        int line = 1;
        while(1) {
            r = recv(fd, buf, 255, 0);
            if(r==-1) break;
            if(r==0) break;
            buf[r] = 0;
            mvwaddstr(winfo, line, 1, buf);
            line++;
            if(line >= (LINES - 3)) {
                wclear(winfo);
                line = 1;
                box(winfo, 0, 0);
            }

            wmove(wmsg, 1, 1);
            touchwin(wmsg);

            refresh();
            wrefresh(winfo);
            wrefresh(wmsg);
        }
        exit(-1);
    }

    destory();
    return 0;
}
コード例 #22
0
ファイル: queue.hpp プロジェクト: nousxiong/actorx
 ~queue()
 {
   while (true)
   {
     auto e = pri_pop();
     if (e != nullptr)
     {
       e->destory();
     }
     else
     {
       break;
     }
   }
 }
コード例 #23
0
ファイル: vector.hpp プロジェクト: 1050676515/zpublic
 bool RemoveAt(int nIndex)
 {
     if (nIndex < 0 || nIndex >= m_Size)
         return false;
     destory(&(m_mem.Get()[nIndex]));
     if (nIndex != m_Size - 1 && m_Size != 1)
     {
         ::memcpy(
             &(m_mem.Get()[nIndex]),
             &(m_mem.Get()[nIndex + 1]),
             (m_Size - nIndex) * sizeof(T));
     }
     m_Size--;
     return true;
 }
コード例 #24
0
ファイル: op-infix.c プロジェクト: HackLinux/C-program
int main(void)
{
	char buf[1024] = "";
	char *p = NULL;
	fgets(buf,sizeof(buf),stdin);
	p = strtok(buf," \n");
	push2(atoi(p));
	while((p = strtok(NULL, " \n")) != NULL)
	{
		char op;
		int b, a;
		switch(*p)
		{
			case '+':
			case '-':
					//if(!is_empty())
					{
						while (top1 != 0) {
							op = pop1();
							//if(*op == ' ')
							//	break;
						b = pop2(); 
						a = pop2(); 
							if(op == '+')
						push2(a + b);
						else 
						push2(a - b);
						};
					}
						push1(*p);
						break;
	 		case '*':
			case '/':
						push1(*p);
						break;
			default: push2(atoi(p));
		}
	}
 switch(pop1()){
	 case '+': printf("%d\n",pop2() + pop2());break;
	 case '-': printf("%d\n",pop2() - pop2());break;
	 case '*': printf("%d\n",pop2() * pop2());break;
	 case '/': printf("%d\n",pop2() / pop2());break;
 }
	//printf("%d\n",pop2());
	destory();
	return 0;
}
コード例 #25
0
ファイル: ppoint.c プロジェクト: flylixiaolong/Learning
int main()
{
	struct Node **p;
	int i=0;
	for(i=0;i<100;i++)
	{
		p=find(i);
		if(!(*p))
		{
			(*p)=malloc(sizeof(struct Node));
			(*p)->next=NULL;
			(*p)->num=i;
		}
	}
	destory();
	return 0;
}
コード例 #26
0
ファイル: lj_drag_image.cpp プロジェクト: dragon101788/hui4
		void init(const char * path)
		{
			if (this->path != path)
			{
				destory();
				this->path = path;
				image tmp;
				tmp.SetResource(path);
				tmp.LoadResource();
				SetBuffer(tmp.GetWidth(), tmp.GetHeight() * 3);

				pos1 = tmp.GetHeight() * 1;
				pos2 = tmp.GetHeight() * 2;
				AreaCopy(&tmp, 0, 0, tmp.GetWidth(), tmp.GetHeight(), 0, 0);
				AreaCopy(&tmp, 0, 0, tmp.GetWidth(), tmp.GetHeight(), 0, pos1);
				AreaCopy(&tmp, 0, 0, tmp.GetWidth(), tmp.GetHeight(), 0, pos2);
			}
		}
コード例 #27
0
void test_string() {
	printf("%s start.\n", __func__);
	char* arr = {"one", "two", "three", "four"};
	create();
	insert(0, &arr[0]);
	insert_first(&arr[1]);
	insert_last(&arr[2]);
	insert(1, &arr[3]);
	
	printf("string is_empty=%d\n", is_empty());
	printf("string size=%d\n", size());
	
	// "two", "four", "one", "three"
	int i;
	char *p;
	int len = size();
	for(i=0; i<len; i++) {
		p = (char*)get(i);
		printf("string get(%d)=%s\n", i, p);
	}
	destory();
	printf("%s finish.\n", __func__);
}
コード例 #28
0
void test_object() {
	printf("%s start.\n", __func__);
	create();
	
	insert(0, &arr_user[0]);
	insert_first(&arr_user[1]);
	insert_last(&arr_user[2]);
	insert(1, &arr_user[3]);
	
	printf("object is_empty=%d\n", is_empty());
	printf("object size=%d\n", size());
	
	int i;
	user *p;
	int len = size();
	for(i=0; i<len; i++) {
		p = (user*)get(i);
		printf("string get(%d)=[%d, %s]\n", i, p->id, p->name);
	}
	
	destory();
	printf("%s finish.\n", __func__);
}
コード例 #29
0
ファイル: homework.c プロジェクト: Rovi/TarenaCode
int main()
{
	Stack *ps = creat(5);
	
	printf("%s\n", full(ps) ? "栈满" : "栈没有");
	printf("%s\n", empty(ps) ? "栈空" : "栈没有");

	push(ps, 20);
	push(ps, 30);
	push(ps, 40);
	push(ps, 50);
	push(ps, 60);
	
	travel(ps);

	pop(ps);
	printf("栈顶元素的值: %d \n", peek(ps));
	printf("栈中元素的个数 %d \n", size(ps));

	destory(ps);
	ps = NULL;
	return 0;
}
コード例 #30
0
void test_int() {
	printf("%s start.\n", __func__);
	int arr[4] = {1, 2, 3, 4};
	create();
	insert(0, &arr[0]);
	insert_first(&arr[1]);
	insert_last(&arr[2]);
	insert(1, &arr[3]);
	
	printf("int is_empty=%d\n", is_empty());
	printf("int size=%d\n", size());
	
	// 2, 4, 1, 3
	int i;
	int *p;
	int len = size();
	for(i=0; i<len; i++) {
		p = (int*)get(i);
		printf("int get(%d)=%d\n", i, *p);
	}
	destory();
	printf("%s finish.\n", __func__);
}