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

C++ Free函数代码示例

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

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



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

示例1: vinum_daemon

void
vinum_daemon(void)
{
    int s;
    struct daemonq *request;

    curproc->p_flag |= P_INMEM | P_SYSTEM;		    /* we're a system process */
    daemon_save_config();				    /* start by saving the configuration */
    daemonpid = curproc->p_pid;				    /* mark our territory */
    while (1) {
        tsleep(&vinum_daemon, PRIBIO, "vinum", 0);	    /* wait for something to happen */

        /*
         * It's conceivable that, as the result of an
         * I/O error, we'll be out of action long
         * enough that another daemon gets started.
         * That's OK, just give up gracefully.
         */
        if (curproc->p_pid != daemonpid) {		    /* we've been ousted in our sleep */
            if (daemon_options & daemon_verbose)
                log(LOG_INFO, "vinum: abdicating\n");
            return;
        }
        while (daemonq != NULL) {			    /* we have work to do, */
            s = splhigh();				    /* don't get interrupted here */
            request = daemonq;				    /* get the request */
            daemonq = daemonq->next;			    /* and detach it */
            if (daemonq == NULL)			    /* got to the end, */
                dqend = NULL;				    /* no end any more */
            splx(s);

            switch (request->type) {
            /*
             * We had an I/O error on a request.  Go through the
             * request and try to salvage it
             */
            case daemonrq_ioerror:
                if (daemon_options & daemon_verbose) {
                    struct request *rq = request->info.rq;

                    log(LOG_WARNING,
                        "vinum: recovering I/O request: %p\n%s dev %d.%d, offset 0x%x, length %ld\n",
                        rq,
                        rq->bp->b_flags & B_READ ? "Read" : "Write",
                        major(rq->bp->b_dev),
                        minor(rq->bp->b_dev),
                        rq->bp->b_blkno,
                        rq->bp->b_bcount);
                }
                recover_io(request->info.rq);		    /* the failed request */
                break;

            /*
             * Write the config to disk.  We could end up with
             * quite a few of these in a row.  Only honour the
             * last one
             */
            case daemonrq_saveconfig:
                if ((daemonq == NULL)			    /* no more requests */
                        ||(daemonq->type != daemonrq_saveconfig)) { /* or the next isn't the same */
                    if (((daemon_options & daemon_noupdate) == 0) /* we're allowed to do it */
                            &&((vinum_conf.flags & VF_READING_CONFIG) == 0)) { /* and we're not building the config now */
                        /*
                           * We obviously don't want to save a
                           * partial configuration.  Less obviously,
                           * we don't need to do anything if we're
                           * asked to write the config when we're
                           * building it up, because we save it at
                           * the end.
                         */
                        if (daemon_options & daemon_verbose)
                            log(LOG_INFO, "vinum: saving config\n");
                        daemon_save_config();		    /* save it */
                    }
                }
                break;

            case daemonrq_return:			    /* been told to stop */
                if (daemon_options & daemon_verbose)
                    log(LOG_INFO, "vinum: stopping\n");
                daemon_options |= daemon_stopped;	    /* note that we've stopped */
                Free(request);
                while (daemonq != NULL) {		    /* backed up requests, */
                    request = daemonq;			    /* get the request */
                    daemonq = daemonq->next;		    /* and detach it */
                    Free(request);			    /* then free it */
                }
                wakeup(&vinumclose);			    /* and wake any waiting vinum(8)s */
                return;

            case daemonrq_ping:				    /* tell the caller we're here */
                if (daemon_options & daemon_verbose)
                    log(LOG_INFO, "vinum: ping reply\n");
                wakeup(&vinum_finddaemon);		    /* wake up the caller */
                break;

            case daemonrq_closedrive:			    /* close a drive */
                close_drive(request->info.drive);	    /* do it */
                break;

//.........这里部分代码省略.........
开发者ID:kame,项目名称:kame,代码行数:101,代码来源:vinumdaemon.c


示例2: stream

/*	METODA WCZYTUJ¥CA DANE
Za³o¿enia pliku s¹ proste.
Na pocz¹tku podstawowe dane, 
a dalej jedziemy ze œcianami
i ca³¹ reszt¹ danych.
*/
const bool CLevel::LoadLevel( const std::string &filename )
{
	if( filename == "" )
	{
		Log.Error( "GLEVEL( " + file + " ): £añcuch znaków jest pusty!" );
		return false;
	}

	// Najpierw definiujemy wskaŸnik na plik i go otwieramy
	std::fstream stream( filename, std::ios::in );

	if( !stream )
	{
		Log.Error( "GLEVEL( " + file + " ): Plik nie istnieje, lub podana œcie¿ka jest b³êdna: " + filename );
		return false;
	}

	// definiujemy zmienne pomocnicze
	std::string str;

	// Pobieramy wersje poziomu oraz j¹ sprawdzamy
	str = GetClearLine( stream );
	if( !sscanf_s( str.c_str(), "E3DTLEV=%u", &Version ) )
	{
		Log.Error( "GLEVEL( " + file + " ): Nieprawid³owy plik poziomu!" );
		return false;
	}

	if( Version > GAME_VERSION )
	{
		Log.Error( "GLEVEL( " + file + " ): Zbyt wysoka wersja pliku!" );
		return false;
	}

	/*	Wczeœnijsze if'y by³y, by uzyskaæ pewnoœæ,
	¿e wszystko z nowym plikiem jest w porz¹dku.
	Dlaczego tyle zachodu? By unikn¹æ sytuacji,
	kiedy ³adujemy plik, na ju¿ istniej¹cy level.
	Level istnieje, wiêc go kasujemy i czytamy plik.
	A teraz Zonk! Nie ma pliku! I co? zostajemy na
	lodzie bez levelu :). Teraz wiecie o co chodzi :)
	*/
	if( loaded )
	{
		Log.Report( "GLEVEL( " + file + " ): Prze³adowanie poziomu na : " + filename );
		Free();
		Player.Reset();
	}

	Log.Log( "GLEVEL( " + file + " ): Wczytywanie poziomu: " + filename );
	//GUI.SendConMsg( "Wczytywanie poziomu: " + filename, false );
	file = filename;

	while( stream )
	{
		str = GetLine( stream );

		if( str == "END E3DTLEV" )
			break;

		str = ClearWhiteSpace( str );

		if( str == "HEADER" )
		{
			if( !LoadHeader( stream ) )
			{
				Log.Error( "GLEVEL( " + file + " ): B³¹d odczytu nag³ówka!" );
				continue;
			}
		}
		else if( str == "TEXTURES" )
		{
			if( !LoadTextures( stream ) )
			{
				Log.Error( "GLEVEL( " + file + " ): B³¹d odczytu tekstur!" );
				continue;
			}
		}
		else if( str == "WALLS" )
		{
			if( !LoadWalls( stream ) )
			{
				Log.Error( "GLEVEL( " + file + " ): B³¹d odczytu œcian!" );
				continue;
			}
		}
		else if( str == "ITEMLIST" )
		{
			if( !LoadItemList( stream ) )
			{
				Log.Error( "GLEVEL( " + file + " ): B³¹d odczytu listy przedmiotów!" );
				continue;
			}
		}
//.........这里部分代码省略.........
开发者ID:realn,项目名称:exptor3D,代码行数:101,代码来源:Level.cpp


示例3: TXUfree

void TXUfree(void)
{  if(TXUok!=TRUE) Bug("TXUok");
   Free(TXUpat);
   Free(TXUtex);
   TXUok=FALSE;
}
开发者ID:AlexMax,项目名称:deutex,代码行数:6,代码来源:texture.c


示例4: Free

XnDeviceModule::~XnDeviceModule()
{
	Free();
}
开发者ID:DogfishLab88,项目名称:debian-openni-sensor-avin2-sensorkinect,代码行数:4,代码来源:XnDeviceModule.cpp


示例5: int

Room *load_RoomData(char *filename, unsigned int number, int flags) {
Room *r;
File *f;
int (*load_func)(File *, Room *, int) = NULL;
int version;

	if (filename == NULL || !*filename || (r = new_Room()) == NULL)
		return NULL;

	if ((f = Fopen(filename)) == NULL) {
		destroy_Room(r);
		return NULL;
	}
	r->number = number;

	version = fileformat_version(f);
	switch(version) {
		case -1:
			log_err("load_RoomData(): error trying to determine file format version of %s", filename);
			load_func = NULL;
			break;

		case 0:
			Frewind(f);
			load_func = load_RoomData_version0;
			break;

		case 1:
			load_func = load_RoomData_version1;
			break;

		default:
			log_err("load_RoomData(): don't know how to load version %d of %s", version, filename);
	}
	if (load_func != NULL && !load_func(f, r, flags)) {
		Fclose(f);
		r->flags &= ROOM_ALL;
/*
	force the room name for Mail> and Home>
	so that find_abbrevRoom() won't act strangely when these names are different in the files
	for some strange reason
*/
		if (r->number == MAIL_ROOM) {
			Free(r->name);
			r->name = cstrdup("Mail");
		}
		if (r->number == HOME_ROOM) {
			Free(r->name);
			r->name = cstrdup("Home");
		}
		if (r->number == MAIL_ROOM)
			r->max_msgs = PARAM_MAX_MAIL_MSGS;
		else
			if (r->max_msgs < 1)
				r->max_msgs = PARAM_MAX_MESSAGES;

		if (PARAM_HAVE_CHATROOMS && (r->flags & ROOM_CHATROOM) && r->chat_history == NULL)
			r->chat_history = new_StringQueue();

		if (!PARAM_HAVE_CHATROOMS && (r->flags & ROOM_CHATROOM) && r->number != HOME_ROOM) {
			r->flags &= ~ROOM_CHATROOM;
			r->flags |= ROOM_DIRTY;
		}
		(void)sort_StringList(&r->room_aides, alphasort_StringList);
		(void)sort_StringList(&r->invited, alphasort_StringList);
		(void)sort_StringList(&r->kicked, alphasort_StringList);
		return r;
	}
	destroy_Room(r);
	Fclose(f);
	return NULL;
}
开发者ID:walterdejong,项目名称:bbs100,代码行数:72,代码来源:Room.c


示例6: Win32LoadSecModule

// Load the device module
bool Win32LoadSecModule(SECURE *sec)
{
	SEC_DATA_WIN32 *w;
	HINSTANCE hInst;
	CK_FUNCTION_LIST_PTR api = NULL;
	CK_RV (*get_function_list)(CK_FUNCTION_LIST_PTR_PTR);
	// Validate arguments
	if (sec == NULL)
	{
		return false;
	}

	if (sec->Dev->Id == 9)
	{
		char username[MAX_SIZE];
		DWORD size;
		// Because the device driver of Juki-Net needs the contents 
		// of the Software\JPKI registry key on HKLU of SYSTEM,
		// if there is no key, copy the key from the value of other user
//		if (MsRegIsValue(REG_CURRENT_USER, "Software\\JPKI", "Name") == false ||
//			MsRegIsValue(REG_CURRENT_USER, "Software\\JPKI", "RWType") == false)
		size = sizeof(username);
		GetUserName(username, &size);
		if (StrCmpi(username, "System") == 0)
		{
			TOKEN_LIST *t = MsRegEnumKey(REG_USERS, NULL);

			if (t != NULL)
			{
				UINT i;

				for (i = 0;i < t->NumTokens;i++)
				{
					char tmp[MAX_PATH];

					if (StrCmpi(t->Token[i], ".DEFAULT") != 0 && StrCmpi(t->Token[i], "S-1-5-18") != 0)
					{
						Format(tmp, sizeof(tmp), "%s\\Software\\JPKI", t->Token[i]);

						if (MsRegIsValue(REG_USERS, tmp, "Name") && MsRegIsValue(REG_USERS, tmp, "RWType"))
						{
							char *name = MsRegReadStr(REG_USERS, tmp, "Name");
							char *port = MsRegReadStr(REG_USERS, tmp, "Port");
							UINT type = MsRegReadInt(REG_USERS, tmp, "RWType");

							MsRegWriteStr(REG_CURRENT_USER, "Software\\JPKI", "Name", name);
							MsRegWriteStr(REG_CURRENT_USER, "Software\\JPKI", "Port", port);
							MsRegWriteInt(REG_CURRENT_USER, "Software\\JPKI", "RWType", type);

							Free(name);
							Free(port);
							break;
						}
					}
				}

				FreeToken(t);
			}
		}
	}

	// Load the Library
	hInst = Win32SecureLoadLibraryEx(sec->Dev->ModuleName, 0);
	if (hInst == NULL)
	{
		// Failure
		return false;
	}

	// Get the API
	get_function_list = (CK_RV (*)(CK_FUNCTION_LIST_PTR_PTR))
		GetProcAddress(hInst, "C_GetFunctionList");

	if (get_function_list == NULL)
	{
		// Failure
		FreeLibrary(hInst);
		return false;
	}

	get_function_list(&api);
	if (api == NULL)
	{
		// Failure
		FreeLibrary(hInst);
		return false;
	}

	sec->Data = ZeroMalloc(sizeof(SEC_DATA_WIN32));
	w = sec->Data;

	w->hInst = hInst;
	sec->Api = api;

	return true;
}
开发者ID:13eatrice,项目名称:SoftEtherVPN,代码行数:97,代码来源:Secure.c


示例7: SDLGL_OpenVideo


//.........这里部分代码省略.........
	if (flags & AG_VIDEO_OVERLAY)
		dsw->flags |= AG_DRIVER_SW_OVERLAY;
	if (flags & AG_VIDEO_BGPOPUPMENU)
		dsw->flags |= AG_DRIVER_SW_BGPOPUP;

	/* Apply the output capture settings. */
	if (AG_Defined(drv, "out")) {
		char *ext;

		AG_GetString(drv, "out", buf, sizeof(buf));
		if ((ext = strrchr(buf, '.')) != NULL &&
		    ext[1] != '\0') {
			if (Strcasecmp(&ext[1], "jpeg") == 0 ||
			    Strcasecmp(&ext[1], "jpg") == 0) {
				sgl->outMode = AG_SDLGL_OUT_JPEG;
				if ((sgl->outPath = TryStrdup(buf)) == NULL)
					return (-1);
			} else if (Strcasecmp(&ext[1], "png") == 0) {
				sgl->outMode = AG_SDLGL_OUT_PNG;
				if ((sgl->outPath = TryStrdup(buf)) == NULL)
					return (-1);
			} else {
				AG_SetError("Invalid out= argument: `%s'", buf);
				return (-1);
			}
			if (AG_Defined(drv, "outFirst")) {
				AG_GetString(drv, "outFirst", buf, sizeof(buf));
				sgl->outFrame = atoi(buf);
			} else {
				sgl->outFrame = 0;
			}
			if (AG_Defined(drv, "outLast")) {
				AG_GetString(drv, "outLast", buf, sizeof(buf));
				sgl->outLast = atoi(buf);
			}
		}
	}
	
	/* Set the video mode. Force hardware palette in 8bpp. */
	AG_SDL_GetPrefDisplaySettings(drv, &w, &h, &depth);
	Verbose(_("SDLGL: Setting mode %ux%u (%d bpp)\n"), w, h, depth);
	newDepth = SDL_VideoModeOK(w, h, depth, sFlags);
	if (newDepth == 8) {
		Verbose(_("Enabling hardware palette"));
		sFlags |= SDL_HWPALETTE;
	}
	if ((sgl->s = SDL_SetVideoMode((int)w, (int)h, newDepth, sFlags))
	    == NULL) {
		AG_SetError("Setting %dx%dx%d mode: %s", w, h, newDepth,
		    SDL_GetError());
		return (-1);
	}
	SDL_EnableUNICODE(1);

	if ((drv->videoFmt = AG_SDL_GetPixelFormat(sgl->s)) == NULL) {
		goto fail;
	}
	dsw->w = sgl->s->w;
	dsw->h = sgl->s->h;
	dsw->depth = (Uint)drv->videoFmt->BitsPerPixel;

	Verbose(_("SDLGL: New display (%dbpp)\n"),
	     (int)drv->videoFmt->BitsPerPixel);
	
	/* Create the cursors. */
	if (AG_SDL_InitDefaultCursor(sgl) == -1 ||
	    AG_InitStockCursors(drv) == -1)
		goto fail;
	
	/* Set background color. */
	dsw->bgColor = AG_ColorFromString(AG_GetStringP(drv,"bgColor"), NULL);

	/* Initialize our OpenGL context and viewport. */
	if (AG_GL_InitContext(sgl, &sgl->gl) == -1) {
		goto fail;
	}
	AG_GL_SetViewport(&sgl->gl, AG_RECT(0, 0, dsw->w, dsw->h));

	if (!(dsw->flags & AG_DRIVER_SW_OVERLAY))
		ClearBackground(dsw);

	/* Initialize the output capture buffer. */
	Free(sgl->outBuf);
	if ((sgl->outBuf = AG_TryMalloc(dsw->w*dsw->h*4)) == NULL) {
		AG_Verbose("Out of memory for buffer; disabling capture\n");
		sgl->outMode = AG_SDLGL_OUT_NONE;
	}
	
	if (flags & AG_VIDEO_FULLSCREEN) {
		if (SDL_WM_ToggleFullScreen(sgl->s))
			dsw->flags |= AG_DRIVER_SW_FULLSCREEN;
	}
	return (0);
fail:
	if (drv->videoFmt) {
		AG_PixelFormatFree(drv->videoFmt);
		drv->videoFmt = NULL;
	}
	return (-1);
}
开发者ID:varialus,项目名称:agar,代码行数:101,代码来源:drv_sdlgl.c


示例8: Free

//********************************************
// Destructor
//********************************************
Texture::~Texture()
{
  Free();
}
开发者ID:Asuzer,项目名称:cgal,代码行数:7,代码来源:texture.cpp


示例9: TEXT


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

        lastRenderTarget = curRenderTarget;

        if(curRenderTarget == (NUM_RENDER_BUFFERS-1))
            curRenderTarget = 0;
        else
            curRenderTarget++;

        if(bUpdateBPS || !CloseDouble(curStrain, lastStrain) || curFramesDropped != lastFramesDropped)
        {
            PostMessage(hwndMain, OBS_UPDATESTATUSBAR, 0, 0);
            lastStrain = curStrain;

            lastFramesDropped = curFramesDropped;
        }

        //------------------------------------
        // we're about to sleep so we should flush the d3d command queue
        profileIn("flush");
        GetD3D()->Flush();
        profileOut;
        profileOut;
        profileOut; //frame

        //------------------------------------
        // frame sync

        QWORD renderStopTime = GetQPCTimeNS();

        if(bWasLaggedFrame = (frameDelta > frameLengthNS))
        {
            numLongFrames++;
            if(bLogLongFramesProfile && (numLongFrames/float(max(1, numTotalFrames)) * 100.) > logLongFramesProfilePercentage)
                DumpLastProfileData();
        }

        //OSDebugOut(TEXT("Frame adjust time: %d, "), frameTimeAdjust-totalTime);

        numTotalFrames++;
    }

    DisableProjector();

    //encodeThreadProfiler.reset();

    if(!bUsing444)
    {
        if(bUseThreaded420)
        {
            for(int i=0; i<numThreads; i++)
            {
                if(h420Threads[i])
                {
                    convertInfo[i].bKillThread = true;
                    SetEvent(convertInfo[i].hSignalConvert);

                    OSTerminateThread(h420Threads[i], 10000);
                    h420Threads[i] = NULL;
                }

                if(convertInfo[i].hSignalConvert)
                {
                    CloseHandle(convertInfo[i].hSignalConvert);
                    convertInfo[i].hSignalConvert = NULL;
                }

                if(convertInfo[i].hSignalComplete)
                {
                    CloseHandle(convertInfo[i].hSignalComplete);
                    convertInfo[i].hSignalComplete = NULL;
                }
            }

            if(!bFirstEncode)
            {
                ID3D10Texture2D *copyTexture = copyTextures[curCopyTexture];
                copyTexture->Unmap(0);
            }
        }

        if(bUsingQSV)
            for(int i = 0; i < NUM_OUT_BUFFERS; i++)
                delete outPics[i].mfxOut;
        else
            for(int i=0; i<NUM_OUT_BUFFERS; i++)
            {
                x264_picture_clean(outPics[i].picOut);
                delete outPics[i].picOut;
            }
    }

    Free(h420Threads);
    Free(convertInfo);

    Log(TEXT("Total frames rendered: %d, number of late frames: %d (%0.2f%%) (it's okay for some frames to be late)"), numTotalFrames, numLongFrames, (double(numLongFrames)/double(numTotalFrames))*100.0);
}
开发者ID:lynnl87,项目名称:OBS,代码行数:101,代码来源:OBSVideoCapture.cpp


示例10: read_config


//.........这里部分代码省略.........
							 "Value out of range");
						return 0;
					} else {
						int             level =
						    (int) lval;

						srv->threads = level;
					}
				} else {
					traceLog(LOG_ERR, err_msg, n,
						 "Non numeric specification");
					return 0;
				}
				break;

			case SSLVERIFYDEPTH:
				if (numstr(cp, &lval) == SPOCP_SUCCESS) {
					if (lval > 0L) {
						srv->sslverifydepth =
						    (unsigned int) lval;
					} else {
						traceLog(LOG_ERR, err_msg, n,
							 "number out of range");
						srv->sslverifydepth = 0;
					}
				} else {
					traceLog(LOG_ERR, err_msg, n,
						 "Non numeric value");
				}
				break;

			case PIDFILE:
				if (srv->pidfile)
					Free(srv->pidfile);
				srv->pidfile = Strdup(cp);
				break;

			case MAXCONN:
				if (numstr(cp, &lval) == SPOCP_SUCCESS) {
					if (lval > 0L) {
						srv->nconn =
						    (unsigned int) lval;
					} else {
						traceLog(LOG_ERR, err_msg, n,
							 "Number out of range");
						srv->sslverifydepth = 0;
					}
				} else {
					traceLog(LOG_ERR, err_msg, n,
						 "Non numeric value");
				}
				break;

#ifdef HAVE_SSL
			case CLIENTCERT:
				if (strcasecmp(cp, "none") == 0)
					srv->clientcert = NONE;
				else if (strcasecmp(cp, "demand") == 0)
					srv->clientcert = DEMAND;
				else if (strcasecmp(cp, "hard") == 0)
					srv->clientcert = HARD;

				break;
#endif
			case NAME:
				if (srv->name)
开发者ID:Zabrane,项目名称:SPOCP,代码行数:67,代码来源:config.c


示例11: Free

CLibrary::~CLibrary()
{
	Free();
}
开发者ID:SamVanheer,项目名称:HL_Tools,代码行数:4,代码来源:CLibrary.cpp


示例12: md_create


//.........这里部分代码省略.........
{
	char mn[MAXNAMELEN + 1];
	char path[PATH_MAX + 1];
	char set_path[PATH_MAX +1];
	char sym_path[PATH_MAX + 1];
	int set = -1, ret;
	char *type, *dir;
	char *device_name;
	dev_t minor_devt = di_minor_devt(minor);
	int key;
	mdsetname_t	*sp = NULL;
	md_error_t ep;

	/*
	 * Initialize sdssc entry points. Don't worry about the return
	 * value here since the interface functions will get initialized
	 * correctly regardless.
	 */
	(void) sdssc_bind_library();

	(void) strcpy(mn, di_minor_name(minor));

	/*
	 * Check whether we are being requested to setup the admin
	 * device link or one of the metadevice links. They need
	 * to be treated differently.
	 */

	if (strcmp(mn, "admin") == 0) {
		/* there is only one admin link and always in /dev/md/admin */
		(void) devfsadm_mklink("md/admin", node, minor, 0);
	} else {
		/*
		 * Extract out the minor components and create the
		 * appropriate links. The node looks like:
		 * [email protected]<set>,<mdev>,<type>
		 * where the <set> number is the named diskset,
		 * <mdev> is the metadevice number, and <type>
		 * is the trailing "blk" or "raw" indication.
		 *
		 * NOTE: when <set> is non-zero, we need to create
		 * under the "shared" directory entry instead of linking
		 * into the top level dsk/rdsk directories.
		 */
		ret = sscanf(mn, "%d,", &set);
		if (ret == 1 && (type = strrchr(mn, ',')) != NULL) {
			type++;
			if (strcmp(type, "blk") == 0) {
				dir = "dsk";
			} else {
				dir = "rdsk";
			}

			(void) memset(&ep, '\0', sizeof (ep));
			if ((device_name = meta_getnmentbydev(set,
			    MD_SIDEWILD, minor_devt, NULL, NULL,
			    &key, &ep)) == NULL) {
				(void) close_admin(&ep);
				return (DEVFSADM_CONTINUE);
			}

			if (set == 0) {
				/* this is a simple md */
				(void) snprintf(path, sizeof (path),
				"md/%s/%s", dir, basename(device_name));
			} else {
				/* this is a shared md */
				(void) snprintf(path, sizeof (path),
				"md/shared/%d/%s/%s", set, dir,
				basename(device_name));

				/*
				 * flush the caches so the next call to
				 * metasetnosetname will get us the
				 * updated cache.
				 */
				metaflushnames(0);
				if ((sp = metasetnosetname(set, &ep))
				    != NULL) {
					(void) snprintf(set_path,
					    sizeof (set_path), "md/shared/%d",
					    sp->setno);
					(void) snprintf(sym_path,
					    sizeof (sym_path), "md/%s",
					    sp->setname);
				}
			}
			(void) devfsadm_mklink(path, node, minor, 0);
			Free(device_name);

			if (sp != NULL) {
				(void) devfsadm_secondary_link(sym_path,
				    set_path, 0);
			}
		}
	}

	(void) close_admin(&ep);
	return (DEVFSADM_CONTINUE);
}
开发者ID:alhazred,项目名称:onarm,代码行数:101,代码来源:md_link.c


示例13: Free

VBObject::~VBObject(void)
{
    Free();
}
开发者ID:ZYMing,项目名称:OpenGL-Shader,代码行数:4,代码来源:vbm.cpp


示例14: main

int main(int argc, char** argv) {
  leveldb_t* db;
  leveldb_comparator_t* cmp;
  leveldb_cache_t* cache;
  leveldb_env_t* env;
  leveldb_options_t* options;
  leveldb_readoptions_t* roptions;
  leveldb_writeoptions_t* woptions;
  char* err = NULL;

  snprintf(dbname, sizeof(dbname), "/tmp/leveldb_c_test-%d",
           ((int) geteuid()));

  StartPhase("create_objects");
  cmp = leveldb_comparator_create(NULL, CmpDestroy, CmpCompare, CmpName);
  env = leveldb_create_default_env();
  cache = leveldb_cache_create_lru(100000);

  options = leveldb_options_create();
  leveldb_options_set_comparator(options, cmp);
  leveldb_options_set_error_if_exists(options, 1);
  leveldb_options_set_cache(options, cache);
  leveldb_options_set_env(options, env);
  leveldb_options_set_info_log(options, NULL);
  leveldb_options_set_write_buffer_size(options, 100000);
  leveldb_options_set_paranoid_checks(options, 1);
  leveldb_options_set_max_open_files(options, 10);
  leveldb_options_set_block_size(options, 1024);
  leveldb_options_set_block_restart_interval(options, 8);
  leveldb_options_set_compression(options, leveldb_no_compression);

  roptions = leveldb_readoptions_create();
  leveldb_readoptions_set_verify_checksums(roptions, 1);
  leveldb_readoptions_set_fill_cache(roptions, 0);

  woptions = leveldb_writeoptions_create();
  leveldb_writeoptions_set_sync(woptions, 1);

  StartPhase("destroy");
  leveldb_destroy_db(options, dbname, &err);
  Free(&err);

  StartPhase("open_error");
  db = leveldb_open(options, dbname, &err);
  CheckCondition(err != NULL);
  Free(&err);

  StartPhase("open");
  leveldb_options_set_create_if_missing(options, 1);
  db = leveldb_open(options, dbname, &err);
  CheckNoError(err);
  CheckGet(db, roptions, "foo", NULL);

  StartPhase("put");
  leveldb_put(db, woptions, "foo", 3, "hello", 5, &err);
  CheckNoError(err);
  CheckGet(db, roptions, "foo", "hello");

  StartPhase("writebatch");
  {
    leveldb_writebatch_t* wb = leveldb_writebatch_create();
    leveldb_writebatch_put(wb, "foo", 3, "a", 1);
    leveldb_writebatch_clear(wb);
    leveldb_writebatch_put(wb, "bar", 3, "b", 1);
    leveldb_writebatch_put(wb, "box", 3, "c", 1);
    leveldb_writebatch_delete(wb, "bar", 3);
    leveldb_write(db, woptions, wb, &err);
    CheckNoError(err);
    CheckGet(db, roptions, "foo", "hello");
    CheckGet(db, roptions, "bar", NULL);
    CheckGet(db, roptions, "box", "c");
    int pos = 0;
    leveldb_writebatch_iterate(wb, &pos, CheckPut, CheckDel);
    CheckCondition(pos == 3);
    leveldb_writebatch_destroy(wb);
  }

  StartPhase("iter");
  {
    leveldb_iterator_t* iter = leveldb_create_iterator(db, roptions);
    CheckCondition(!leveldb_iter_valid(iter));
    leveldb_iter_seek_to_first(iter);
    CheckCondition(leveldb_iter_valid(iter));
    CheckIter(iter, "box", "c");
    leveldb_iter_next(iter);
    CheckIter(iter, "foo", "hello");
    leveldb_iter_prev(iter);
    CheckIter(iter, "box", "c");
    leveldb_iter_prev(iter);
    CheckCondition(!leveldb_iter_valid(iter));
    leveldb_iter_seek_to_last(iter);
    CheckIter(iter, "foo", "hello");
    leveldb_iter_seek(iter, "b", 1);
    CheckIter(iter, "box", "c");
    leveldb_iter_get_error(iter, &err);
    CheckNoError(err);
    leveldb_iter_destroy(iter);
  }

  StartPhase("approximate_sizes");
//.........这里部分代码省略.........
开发者ID:0xffffffff,项目名称:rtbkit,代码行数:101,代码来源:c_test.c


示例15: Free

	/** Virtual destructor calls Free() to delete the objects contained
	in the linked list, in a thread-safe manner.*/
	virtual ~VCriticalLinkedListManager()
		{ Free(); }
开发者ID:OCLC-Developer-Network,项目名称:MARCView-Convert,代码行数:4,代码来源:vcriticallinkedlistmanager.hpp


示例16: Free

CEncoder::~CEncoder()
{
  Free();
}
开发者ID:670232921,项目名称:pfm_archive,代码行数:4,代码来源:BZip2Encoder.cpp


示例17: Free

/*
================
idEvent::~idEvent()
================
*/
idEvent::~idEvent() {
	Free();
}
开发者ID:iodoom-gitorious,项目名称:windowshasyous-dhewg-iodoom3,代码行数:8,代码来源:Event.cpp


示例18: finalizeIAL

void finalizeIAL(IntArrayList *a) {
	Free(a->p);
}
开发者ID:CompBioUIC,项目名称:CommDy,代码行数:3,代码来源:IntArrayList.c


示例19: Free

RobotManager::~RobotManager(void)
{
	Free();
}
开发者ID:zhangqiaoli,项目名称:robot,代码行数:4,代码来源:RobotManager.cpp


示例20: Free

bool DHCPOptionParser::Parse( struct dhcp_packet *dp )
{
    int code;
    int len;
    unsigned char *data;
    int i, j;

    if( memcmp( dp->options, DHCP_OPTIONS_COOKIE, 4 ))
        return false;

    Free();

    for( i = 4; ( code = dp->options[ i++ ]) != DHO_END; )
    {
        if( code == DHO_PAD )
            continue;

        len  = dp->options[ i++ ];
        data = &dp->options[ i ];

        switch( code )
        {
            case DHO_DHCP_MESSAGE_TYPE :
                mMsgType = *data;
                break;

            case DHO_DHCP_SERVER_IDENTIFIER :
                mSID = *reinterpret_cast< struct in_addr * >( data );
                break;

            case DHO_DHCP_LEASE_TIME :
                mLeaseTime = *reinterpret_cast< u_int32_t * >( data );
                break;

            case DHO_SUBNET_MASK :
                mSubnetMask = *reinterpret_cast< struct in_addr * >( data );
                break;

            case DHO_ROUTERS :
            {
                mRouterCount = static_cast< u_int8_t >( len / 4 );
                mRouterList  = new struct in_addr[ mRouterCount ];
                for( j = 0; j < len; j += 4 )
                    mRouterList[ j / 4 ] = *reinterpret_cast
                                                < struct in_addr *>
                                                    ( &data[ j ]);
                break;
            }

            case DHO_DOMAIN_NAME_SERVERS :
            {
                mDNSCount = static_cast< u_int8_t >( len / 4 );
                mDNSList  = new struct in_addr[ mDNSCount ];
                for( j = 0; j < len; j += 4 )
                    mDNSList[ j / 4 ] = *reinterpret_cast
                                            < struct in_addr *>( &data[ j ]);
                break;
            }

            case DHO_DOMAIN_NAME :
                mDomainName = new char[ len + 1 ]();
                memcpy( mDomainName, data, len );
                break;
        }

        i += len;
    }

    return true;
}
开发者ID:komh,项目名称:kipcfg,代码行数:70,代码来源:dhcp_options.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ FreeBrush函数代码示例发布时间:2022-05-30
下一篇:
C++ Fread函数代码示例发布时间: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