• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ clean函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中clean函数的典型用法代码示例。如果您正苦于以下问题:C++ clean函数的具体用法?C++ clean怎么用?C++ clean使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了clean函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: clean

void QgsProviderRegistry::setLibraryDirectory( QDir const & path )
{
  mLibraryDirectory = path;
  clean();
  init();
}
开发者ID:3liz,项目名称:Quantum-GIS,代码行数:6,代码来源:qgsproviderregistry.cpp


示例2: clean

Histogram::Histogram(unsigned char max, unsigned char min, unsigned char *n)
{
	clean();

	Resize(max, min, n);
}
开发者ID:Karma-Revolutions,项目名称:icub-main,代码行数:6,代码来源:histogram.cpp


示例3: clean

Object::~Object(){
	clean();
}
开发者ID:johnthebrave,项目名称:GameEngine,代码行数:3,代码来源:ObjectFactory.cpp


示例4: main

int
main(int argc, char **argv)
{
	pdf_cmap *cmap;
	fz_stream *fi;
	FILE *fo;
	char name[256];
	char *realname;
	int i, k, m;
	fz_context *ctx;

	if (argc < 3)
	{
		fprintf(stderr, "usage: cmapdump output.c lots of cmap files\n");
		return 1;
	}

	ctx = fz_new_context(NULL, NULL, FZ_STORE_UNLIMITED);
	if (!ctx)
	{
		fprintf(stderr, "cannot initialise context\n");
		return 1;
	}

#undef fopen
	fo = fopen(argv[1], "wb");
	if (!fo)
	{
		fprintf(stderr, "cmapdump: could not open output file '%s'\n", argv[1]);
		return 1;
	}

	fprintf(fo, "/* This is an automatically generated file. Do not edit. */\n");

	for (i = 2; i < argc; i++)
	{
		realname = strrchr(argv[i], '/');
		if (!realname)
			realname = strrchr(argv[i], '\\');
		if (realname)
			realname ++;
		else
			realname = argv[i];

		/* ignore VCS folders (such as .svn) */
		if (*realname == '.')
			continue;

		if (strlen(realname) > (sizeof name - 1))
		{
			fprintf(stderr, "cmapdump: file name too long\n");
			if (fclose(fo))
			{
				fprintf(stderr, "cmapdump: could not close output file '%s'\n", argv[1]);
				return 1;
			}
			return 1;
		}

		strcpy(name, realname);
		clean(name);

		fi = fz_open_file(ctx, argv[i]);
		cmap = pdf_load_cmap(ctx, fi);
		fz_close(fi);

		fprintf(fo, "\n/* %s */\n\n", cmap->cmap_name);

		if (cmap->rlen)
		{
			fprintf(fo, "static const pdf_range cmap_%s_ranges[] = {", name);
			for (k = 0; k < cmap->rlen; k++)
			{
				if (k % 4 == 0)
					fprintf(fo, "\n");
				fprintf(fo, "{%uu,%uu,%uu},", cmap->ranges[k].low, cmap->ranges[k].high, cmap->ranges[k].out);
			}
			fprintf(fo, "\n};\n\n");
		}

		if (cmap->xlen)
		{
			fprintf(fo, "static const pdf_xrange cmap_%s_xranges[] = {", name);
			for (k = 0; k < cmap->xlen; k++)
			{
				if (k % 4 == 0)
					fprintf(fo, "\n");
				fprintf(fo, "{%uu,%uu,%uu},", cmap->xranges[k].low, cmap->xranges[k].high, cmap->xranges[k].out);
			}
			fprintf(fo, "\n};\n\n");
		}

		if (cmap->mlen > 0)
		{
			fprintf(fo, "static const pdf_mrange cmap_%s_mranges[] = {", name);
			for (k = 0; k < cmap->mlen; k++)
			{
				fprintf(fo, "\n{%uu,%uu,{", cmap->mranges[k].low, cmap->mranges[k].len);
				for (m = 0; m < PDF_MRANGE_CAP; ++m)
					fprintf(fo, "%uu,", cmap->mranges[k].out[m]);
//.........这里部分代码省略.........
开发者ID:EvoGroupTN,项目名称:mupdf,代码行数:101,代码来源:cmapdump.c


示例5: on_signal

void on_signal(int sig) {
    debug("Caught signal %d.\n", sig);
    clean();
}
开发者ID:czaber,项目名称:ogwm,代码行数:4,代码来源:main.c


示例6: clean

Scope::~Scope() {
  clean();
}
开发者ID:Josok,项目名称:EasyDarwin,代码行数:3,代码来源:GroupEId.cpp


示例7: in


//.........这里部分代码省略.........
		{
			char tmp[200];
			
			//Read the name of the material to tmp
			sscanf(coord[i]->c_str(), "usemtl %s", tmp);  

			//Go through all of the materials
			for (int i = 0; i<materials.size(); i++)     
			{
				//And compare the tmp with the name of the material
				if (strcmp(materials[i]->name.c_str(), tmp) == 0)   
				{
					//If it's equal then set the current material to that
					curmat = i;       
					break;
				}
			}
		}
		//Material library, a file, which contain all of the materials
		else if ((*coord[i])[0] == 'm' && (*coord[i])[1] == 't' && (*coord[i])[2] == 'l' && (*coord[i])[3] == 'l')      
		{
			char filen[200];
			
			//Read the fileName
			sscanf(coord[i]->c_str(), "mtllib %s", filen);    
			
			//Open the file
			ifstream mtlin(filen);     
			
			//If not opened, show a error message, clean all memory, then return with -1
			if (!mtlin.is_open())    
			{
				cout << "connot open the material file" << endl;
				clean();
				return -1;
			}
			
			//We use materials
			ismaterial = true;        
			
			//Contain the line of the file
			vector<string> tmp;
			
			char c[200];
			
			while (!mtlin.eof())
			{
				//Read all lines to tmp
				mtlin.getline(c, 200);   
				tmp.push_back(c);
			}
			
			//Name of the material
			char name[200]; 
			
			//fileName of the texture
			char fileName[200];     
			
			//Colors, shininess, etc
			float amb[3], dif[3], spec[3], alpha, ns, ni;        
			
			int illum;
			unsigned int texture;
			
			//Do we already have a material read in to these variables?
			bool ismat = false;       
开发者ID:Robbiep003,项目名称:AGEC,代码行数:67,代码来源:ObjLoader.cpp


示例8: clean

ActorManager::~ActorManager()
{
 clean();
}
开发者ID:nuvie,项目名称:nuvie,代码行数:4,代码来源:ActorManager.cpp


示例9: clean

void BonusManager::init() {
	clean();
	instance = new BonusManager();
}
开发者ID:Wookesh,项目名称:SteamNations,代码行数:4,代码来源:Bonuses.cpp


示例10: clean

void vpKltOpencv::reset()
{
    clean();

}
开发者ID:tswang,项目名称:visp,代码行数:5,代码来源:vpKltOpencv.cpp


示例11: clean

	/** modify **/
	bool Url::parse(String* url){
		// clean
		clean();
		
		// check
		if(!url){
			return false;
		}

		// prepare sz
		const char* sz =url->c_str();
		// puts(sz);

		// protocol
		const char* cursor =strstr(sz, "://");
		int64_t pos =(cursor ? (cursor-sz) : -1);
		if(pos == 0){
			ERROR("fail to call %s, len(protocol) can't be 0");
			return false;
		}
		else if(pos > 0){
			ASSIGN_POINTER(m_protocol, String::New(sz, pos));
			sz =cursor + 3;
		}

		// auth
		cursor =strchr(sz, '@');
		pos =(cursor ? (cursor-sz) : -1);
		if(pos == 0){
			CLEAN_POINTER(m_protocol);
			ERROR("fail to call %s, len(auth) can't be 0");
			return false;
		}
		else if(pos > 0){
			ASSIGN_POINTER(m_auth, String::New(sz, pos));
			sz =cursor + 1;
		}

		// host
		const char* szbeg =sz;
		while(const char ch =*sz){
			if(ch=='/' || ch=='?' || ch=='#'){
				break;
			}
			++sz;
		}
		if(sz > szbeg){
			ASSIGN_POINTER(m_host, String::New(szbeg, sz-szbeg));
		}

		// path
		if(*sz == '/'){
			const char* szbeg =sz++;
			while(const char ch =*sz){
				if(ch=='?' || ch=='#'){
					break;
				}
				++sz;
			}
			ASSIGN_POINTER(m_path, String::New(szbeg, sz-szbeg));
		}

		// query
		if(*sz == '?'){
			const char* szbeg =++sz;
			while(const char ch =*sz){
				if(ch == '#'){
					break;
				}
				++sz;
			}
			if(sz > szbeg){
				ASSIGN_POINTER(m_query_string, String::New(szbeg, sz-szbeg));
				ASSIGN_POINTER(m_query, SafeNew<Hash>());
				if(!ParseQuery(m_query_string, m_query)){
					clean();
					return false;
				}
			}
			else{
				ASSIGN_POINTER(m_query_string, String::New(szbeg, sz-szbeg));
			}
		}

		// fragment
		if(*sz == '#'){
			ASSIGN_POINTER(m_fragment, String::New(sz+1));
		}

		// url
		ASSIGN_POINTER(m_url, url);

		return true;
	}
开发者ID:AllenWangxiao,项目名称:winner,代码行数:95,代码来源:Url.cpp


示例12: Bellman_Ford


//.........这里部分代码省略.........
      }
      //^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ //


      //waking all the sending threads.
      //^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ //
//      if(sent==routing_table->directNeighbors){
//
////          printf("Bellman_Ford():signal sent to convar2\n");
// //         sent=-1;
////          for(i=0;i<routing_table->directNeighbors;i++){
////              pthread_cond_signal(&convar2);
////          }
////          pthread_mutex_unlock(&mutex);
////          pthread_mutex_lock(&mutex);
//      }
      //^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ //


      //^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ //
      //in the case which all of the other nodes sent 0 then finishing the algorithm
      if(zeroReceived>=routing_table->directNeighbors){
          received=-1;
          sent=-1;
    //      printf("Bellman_Ford():signal sent to convar1+2+3\n");
          for(i=0;i<routing_table->directNeighbors;i++){
              pthread_cond_signal(&convar1);
          }
//          for(i=0;i<routing_table->directNeighbors;i++){
//              pthread_cond_signal(&convar2);
//          }

          pthread_cond_signal(&convar3);
          pthread_mutex_unlock(&mutex);

          pthread_mutex_lock(&mutex);
      //    printf("Bellman_Ford():done=1\n");

          break;
      }
      //^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ //


      //^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ //
      //in the case which all neighbors's DV received ,waking the recomputing thread.
      if(received>=routing_table->directNeighbors&& sent>=routing_table->directNeighbors){

         // printf("Bellman_Ford():signal sent to convar3\n");
          received=-1;
          sent=-1;
          pthread_cond_signal(&convar3);
          pthread_mutex_unlock(&mutex);
          pthread_mutex_lock(&mutex);
      }
      //^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ //


      //^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ //
      //reset all the global variables
      if(doneComputing==1){
          received=0;
          sent=0;
          sentOnce=0;
          doneComputing=0;
      }


      pthread_mutex_unlock(&mutex);
  }
 // printf("Bellman_Ford():outside main loop\n");

  pthread_mutex_unlock(&mutex);









  //joining all the threads-this means the main thread will wait until all of the threads will exist.
  pthread_join(recompute, NULL);
  for (i=0; i<routing_table->directNeighbors*2; i++) {
      pthread_join(threads[i], NULL);
  }



 // printTable();
 // printf("printing via\n\n\n");
//  for(i=0;i<routing_table->numOfNodes;i++)
//    printf("%d\t",routing_table->via[i]);
//  printf("\n\n\n");
  printFinalResualt();//printing resualt
//  printf("\n\n\n");
  clean();//cleaning all the dynamically allocated memory,

  exit(0);
}
开发者ID:gabaynati,项目名称:BFS-routing-implementation,代码行数:101,代码来源:main.c


示例13: add_refentity_name

CubitStatus RefEntityName::add_refentity_name(RefEntity *entity,
                                              DLIList<CubitString> &names,
                                              bool update_attribs, 
                                              bool check_name_validity)
{
  names.reset();
  //int num_new_names = names.size();

  DLIList<CubitString> new_names;
  
  for (int i=0; i<names.size(); i++)
  {
    CubitString name = names[i];
    CubitString in_name = name;
    CubitBoolean warn_name_change = CUBIT_FALSE;
    
      // first, clean the name
    if (check_name_validity)
    {
      if (clean(name))
      {
        // assign original name anyway, then
        // continue on and assign modified name.
        add_refentity_name(entity, in_name, false, false);
        warn_name_change = CUBIT_TRUE;
      }
    }
      // now, check for valid name
    CubitBoolean name_valid = CUBIT_FALSE;
    
    if (name == "")
    {
        // blank name entered - do nothing
    }
    
    else if (nameEntityList.move_to(name) &&
             nameEntityList.get()->value() == entity)
    {
        // Tried to assign same name to entity
      if ( DEBUG_FLAG(92) ) 
      {
          // check to see if it's the same as this entity's default name,
          // if so, it probably came in on an attribute, and we don't need
          // to hear about it; otherwise, write the warning
        CubitString def_name;
        entity->generate_default_name(def_name);
        if (name != def_name)
          PRINT_INFO("Entity name '%s' already assigned to %s %d\n",
                     name.c_str(), 
                     entity->class_name(), entity->id());
      }
    }
    else if (nameEntityList.move_to(name) &&
             nameEntityList.get()->value() != entity)
    {
        // Tried to assign existing name to another entity
      PRINT_DEBUG_92( "Entity name '%s' for %s %d is already used by %s %d\n",
                  name.c_str(), entity->class_name(), entity->id(),
                  nameEntityList.get()->value()->class_name(),
                  nameEntityList.get()->value()->id());
      
        // either we fix it and keep it, or we don't and get rid of it
      name_valid = CUBIT_FALSE;
      if (get_fix_duplicate_names())
      {
        if (generate_unique_name(name))
        {
          PRINT_DEBUG_92( "\t%s %d name changed to '%s'\n",
                          entity->class_name(), entity->id(), name.c_str());
          if(warn_name_change)
          {
            PRINT_WARNING("Entity name '%s' can't be used in commands.\n"
                 "         Additional name '%s' assigned.\n",
              in_name.c_str(), name.c_str());
          }
          
          name_valid = CUBIT_TRUE;
        }
      }
    }
    else
    {
      if(warn_name_change)
      {
        PRINT_WARNING("Entity name '%s' can't be used in commands.\n"
          "         Additional name '%s' assigned.\n",
          in_name.c_str(), name.c_str());
      }
      
        // else the name must be valid
      name_valid = CUBIT_TRUE;
    }
    
    if (name_valid == CUBIT_TRUE)
    {
        // name is valid
      if (name != in_name)
          // name was changed; change in name list too
        names[i] = name;

//.........这里部分代码省略.........
开发者ID:chrismullins,项目名称:cgma,代码行数:101,代码来源:RefEntityName.cpp


示例14: init

 void init() {
     m_exportFile = "exportfile";
     m_manager = new QLandmarkManager;
     m_handler = new QLandmarkFileHandlerLmx;
     clean();
 }
开发者ID:ionionica,项目名称:qt-mobility,代码行数:6,代码来源:tst_qlandmarkfilehandler_lmx.cpp


示例15: clean

void Map::terminate()
{
    clean();
}
开发者ID:EvilSmock,项目名称:otclient,代码行数:4,代码来源:map.cpp


示例16: clean

ScoreManager::~ScoreManager() {
    clean();
}
开发者ID:Wh1t3L0tus,项目名称:SpaceRace,代码行数:3,代码来源:ScoreManager.cpp


示例17: appli_message

int KrigingMean::execute( GsTL_project* ) {
  // those flags will be used to signal if some of the nodes could not be
  // informed
  bool issue_singular_system_warning = false;
  bool issue_no_conditioning_data_warning = false;
 
  // Set up a progress notifier	
  int total_steps = simul_grid_->size();
  int frequency = std::max( total_steps / 20, 1 );
  SmartPtr<Progress_notifier> progress_notifier = 
    utils::create_notifier( "Running Kriging", 
			    total_steps, frequency );

  // create the property
  appli_message("creating new property: " << property_name_ << "..." );
  GsTLGridProperty* prop = 
    geostat_utils::add_property_to_grid( simul_grid_, property_name_ );
  simul_grid_->select_property( prop->name() );

  typedef Geostat_grid::iterator iterator;
  iterator begin = simul_grid_->begin();
  iterator end = simul_grid_->end();
  
  for( ; begin != end; ++begin ) {
    if( !progress_notifier->notify() ) {
      clean( property_name_ );
      return 1;
    }

    if( begin->is_informed() ) continue;
    
      
    neighborhood_->find_neighbors( *begin );
    if( neighborhood_->size() < min_neigh_ )  continue;
    if(!neighborhood_->is_valid()) continue;
    

    double variance;



    int status;
    

    status = kriging_weights_2( kriging_weights_, variance,
                                  begin->location(), *(neighborhood_.raw_ptr()),
                      				    covar_,*rhs_covar_, *Kconstraints_ );


    if(status == 0) {
    	// the kriging system could be solved
    	double estimate = (*combiner_)( kriging_weights_.begin(), 
		                            			kriging_weights_.end(),
					                            *(neighborhood_.raw_ptr()) );
      begin->set_property_value( estimate );

    }
    else {
    	// the kriging system could not be solved, issue a warning and skip the
    	// node
      issue_singular_system_warning = true;
        
    }
  }
/* This pop-up windows breaks script

  if( issue_singular_system_warning )
    GsTLcerr << "Kriging could not be performed at some locations because\n"
             << "the kriging system was singular\n" 
             << gstlIO::end; 
  if( issue_no_conditioning_data_warning )
    GsTLcerr << "Kriging could not be performed at some locations because\n"
             << "the neighborhood of those locations was empty.\n"
             << "Try increasing the size of the search ellipsoid.\n"
             << gstlIO::end; 
*/

  return 0;
}
开发者ID:fnavarrov,项目名称:SGeMS,代码行数:79,代码来源:kriging_mean.cpp


示例18: in

int objloader::load(const char* filename)
{
	std::ifstream in(filename);
	if(!in.is_open())
	{
		std::cout << "Nor oepened" << std::endl;
		return -1;
	}
	char buf[256];
	int curmat=0;
	while(!in.eof())
	{
		in.getline(buf,256);
		coord.push_back(new std::string(buf));
	}
	for(int i=0;i<coord.size();i++)
	{
		if((*coord[i])[0]=='#')
			continue;
		else if((*coord[i])[0]=='v' && (*coord[i])[1]==' ')
		{
			float tmpx,tmpy,tmpz;
			sscanf(coord[i]->c_str(),"v %f %f %f",&tmpx,&tmpy,&tmpz);
			vertex.push_back(new coordinate(tmpx,tmpy,tmpz));
		}else if((*coord[i])[0]=='v' && (*coord[i])[1]=='n')
		{
			float tmpx,tmpy,tmpz;
			sscanf(coord[i]->c_str(),"vn %f %f %f",&tmpx,&tmpy,&tmpz);
			normals.push_back(new coordinate(tmpx,tmpy,tmpz));	
		}else if((*coord[i])[0]=='f')
		{
			int a,b,c,d,e;
			if(count(coord[i]->begin(),coord[i]->end(),' ')==4)
			{
				if(coord[i]->find("//")!=std::string::npos)
				{
					sscanf(coord[i]->c_str(),"f %d//%d %d//%d %d//%d %d//%d",&a,&b,&c,&b,&d,&b,&e,&b);
					faces.push_back(new face(b,a,c,d,e,0,0,0,0,curmat));
				}else if(coord[i]->find("/")!=std::string::npos)
				{
					int t[4];
					sscanf(coord[i]->c_str(),"f %d/%d/%d %d/%d/%d %d/%d/%d %d/%d/%d",&a,&t[0],&b,&c,&t[1],&b,&d,&t[2],&b,&e,&t[3],&b);
					faces.push_back(new face(b,a,c,d,e,t[0],t[1],t[2],t[3],curmat));
				}else{
					sscanf(coord[i]->c_str(),"f %d %d %d %d",&a,&b,&c,&d);
					faces.push_back(new face(-1,a,b,c,d,0,0,0,0,curmat));					
				}
			}else{
					if(coord[i]->find("//")!=std::string::npos)
					{
						sscanf(coord[i]->c_str(),"f %d//%d %d//%d %d//%d",&a,&b,&c,&b,&d,&b);
						faces.push_back(new face(b,a,c,d,0,0,0,curmat));
					}else if(coord[i]->find("/")!=std::string::npos)
					{
						int t[3];
						sscanf(coord[i]->c_str(),"f %d/%d/%d %d/%d/%d %d/%d/%d",&a,&t[0],&b,&c,&t[1],&b,&d,&t[2],&b);
						faces.push_back(new face(b,a,c,d,t[0],t[1],t[2],curmat));
					}else{
						sscanf(coord[i]->c_str(),"f %d %d %d",&a,&b,&c);
						faces.push_back(new face(-1,a,b,c,0,0,0,curmat));					
					}
			}
	}else if((*coord[i])[0]=='u' && (*coord[i])[1]=='s' && (*coord[i])[2]=='e')
	{
		char tmp[200];
		sscanf(coord[i]->c_str(),"usemtl %s",tmp);
		for(int i=0;i<materials.size();i++)
		{
			if(strcmp(materials[i]->name.c_str(),tmp)==0)
			{
				curmat=i;
				break;
			}
		}
	}else if((*coord[i])[0]=='m' && (*coord[i])[1]=='t' && (*coord[i])[2]=='l' && (*coord[i])[3]=='l')
	{
		char filen[200];
		sscanf(coord[i]->c_str(),"mtllib %s",filen);
		std::ifstream mtlin(filen);
		if(!mtlin.is_open())
		{
			std::cout << "connot open the material file" << std::endl;
			clean();
			return -1;
		}
		ismaterial=true;
		std::vector<std::string> tmp;
		char c[200];
		while(!mtlin.eof())
		{
			mtlin.getline(c,200);
			tmp.push_back(c);
		}
		char name[200];
		char filename[200];
		float amb[3],dif[3],spec[3],alpha,ns,ni;
		int illum;
		unsigned int texture;
		bool ismat=false;
		strcpy(filename,"\0");
//.........这里部分代码省略.........
开发者ID:davidjacobo,项目名称:ddr_robot,代码行数:101,代码来源:objloader.cpp


示例19: xfile

Xfile *
xfile(int fid, int flag)
{
	Xfile **hp, *f, *pf;
	int k;

	k = ((uint32_t)fid) % FIDMOD;
	hp = &xfiles[k];
	mlock(&xlocks[k]);
	pf = nil;
	for(f=*hp; f; f=f->next){
		if(f->fid == fid)
			break;
		pf = f;
	}
	if(f && pf){
		pf->next = f->next;
		f->next = *hp;
		*hp = f;
	}
	switch(flag){
	default:
		panic("xfile");
	case Asis:
		unmlock(&xlocks[k]);
		return (f && f->xf && f->xf->dev < 0) ? nil : f;
	case Clean:
		break;
	case Clunk:
		if(f){
			*hp = f->next;
			unmlock(&xlocks[k]);
			clean(f);
			mlock(&freelock);
			f->next = freelist;
			freelist = f;
			unmlock(&freelock);
		} else
			unmlock(&xlocks[k]);
		return nil;
	}
	unmlock(&xlocks[k]);
	if(f)
		return clean(f);
	mlock(&freelock);
	if(f = freelist){	/* assign = */
		freelist = f->next;
		unmlock(&freelock);
	} else {
		unmlock(&freelock);
		f = malloc(sizeof(Xfile));
		if(f == nil){
			errno = Enomem;
			return nil;
		}
	}
	mlock(&xlocks[k]);
	f->next = *hp;
	*hp = f;
	unmlock(&xlocks[k]);
	f->fid = fid;
	f->flags = 0;
	f->qid = (Qid){0,0,0};
	f->xf = nil;
	f->ptr = nil;
	return f;
}
开发者ID:Requaos,项目名称:harvey,代码行数:67,代码来源:xfile.c


示例20: clean

YARP3DHistogram::YARP3DHistogram()
{
	clean();
}
开发者ID:robotology-legacy,项目名称:yarp1,代码行数:4,代码来源:YARP3DHistogram.cpp



注:本文中的clean函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ clean_exit函数代码示例发布时间:2022-05-30
下一篇:
C++ classname函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap