本文整理汇总了C++中UNLINK函数的典型用法代码示例。如果您正苦于以下问题:C++ UNLINK函数的具体用法?C++ UNLINK怎么用?C++ UNLINK使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UNLINK函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: scsp_dcs_cleanup
/*
* Clean up a DCS block. This routine is called to clear out any
* lingering state information when the CA FSM reverts to an 'earlier'
* state (Down or Master/Slave Negotiation).
*
* Arguments:
* dcsp pointer to a DCS control block for the neighbor
*
* Returns:
* none
*
*/
void
scsp_dcs_cleanup(Scsp_dcs *dcsp)
{
Scsp_cse *csep, *ncsep;
Scsp_csa *csap, *next_csap;
Scsp_csu_rexmt *rxp, *rx_next;
/*
* Free any CSAS entries waiting to be sent
*/
for (csep = dcsp->sd_ca_csas; csep; csep = ncsep) {
ncsep = csep->sc_next;
UNLINK(csep, Scsp_cse, dcsp->sd_ca_csas, sc_next);
UM_FREE(csep);
}
/*
* Free any entries on the CRL
*/
for (csap = dcsp->sd_crl; csap; csap = next_csap) {
next_csap = csap->next;
UNLINK(csap, Scsp_csa, dcsp->sd_crl, next);
SCSP_FREE_CSA(csap);
}
/*
* Free any saved CA message and cancel the CA
* retransmission timer
*/
if (dcsp->sd_ca_rexmt_msg) {
scsp_free_msg(dcsp->sd_ca_rexmt_msg);
dcsp->sd_ca_rexmt_msg = NULL;
}
HARP_CANCEL(&dcsp->sd_ca_rexmt_t);
/*
* Free any saved CSU Solicit message and cancel the CSUS
* retransmission timer
*/
if (dcsp->sd_csus_rexmt_msg) {
scsp_free_msg(dcsp->sd_csus_rexmt_msg);
dcsp->sd_csus_rexmt_msg = NULL;
}
HARP_CANCEL(&dcsp->sd_csus_rexmt_t);
/*
* Free any entries on the CSU Request retransmission queue
*/
for (rxp = dcsp->sd_csu_rexmt; rxp; rxp = rx_next) {
rx_next = rxp->sr_next;
HARP_CANCEL(&rxp->sr_t);
for (csap = rxp->sr_csa; csap; csap = next_csap) {
next_csap = csap->next;
SCSP_FREE_CSA(csap);
}
UNLINK(rxp, Scsp_csu_rexmt, dcsp->sd_csu_rexmt,
sr_next);
UM_FREE(rxp);
}
}
示例2: clear_news
void clear_news( bool sMatch, int nCount )
{
int nCurrent = 1;
NEWS_DATA *news;
if ( sMatch == FALSE ) {
while ( ( news = first_news ) != NULL ) {
STRFREE( news->data );
UNLINK( news, first_news, last_news, next, prev );
DISPOSE( news );
}
}
else {
for ( news = first_news; news != NULL; news = news->next ) {
if ( nCount == nCurrent ) {
STRFREE( news->data );
UNLINK( news, first_news, last_news, next, prev );
DISPOSE( news );
break;
}
else
nCurrent++;
}
}
}
示例3: dispose_ban
void dispose_ban( BAN_DATA * pban, int type )
{
if( !pban )
return;
if( type != BAN_SITE && type != BAN_CLASS && type != BAN_RACE )
{
bug( "%s: Unknown Ban Type %d.", __func__, type );
return;
}
switch ( type )
{
case BAN_SITE:
UNLINK( pban, first_ban, last_ban, next, prev );
break;
case BAN_CLASS:
UNLINK( pban, first_ban_class, last_ban_class, next, prev );
break;
case BAN_RACE:
UNLINK( pban, first_ban_race, last_ban_race, next, prev );
break;
}
free_ban( pban );
}
示例4: testCreateFromFile
static int
testCreateFromFile ()
{
struct GNUNET_CRYPTO_RsaPrivateKey *key;
struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded p1;
struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded p2;
key = GNUNET_CRYPTO_rsa_key_create_from_file (KEYFILE);
GNUNET_assert (NULL != key);
GNUNET_CRYPTO_rsa_key_get_public (key, &p1);
GNUNET_CRYPTO_rsa_key_free (key);
key = GNUNET_CRYPTO_rsa_key_create_from_file (KEYFILE);
GNUNET_assert (NULL != key);
GNUNET_CRYPTO_rsa_key_get_public (key, &p2);
GNUNET_assert (0 == memcmp (&p1, &p2, sizeof (p1)));
GNUNET_CRYPTO_rsa_key_free (key);
GNUNET_assert (0 == UNLINK (KEYFILE));
key = GNUNET_CRYPTO_rsa_key_create_from_file (KEYFILE);
GNUNET_assert (NULL != key);
GNUNET_CRYPTO_rsa_key_get_public (key, &p2);
GNUNET_assert (0 != memcmp (&p1, &p2, sizeof (p1)));
GNUNET_CRYPTO_rsa_key_free (key);
GNUNET_assert (0 == UNLINK (KEYFILE));
return GNUNET_OK;
}
示例5: extract_char
void extract_char(Character *ch, bool fPull)
{
for (Object * obj_next, *obj = ch->carrying; obj != NULL;
obj = obj_next)
{
obj_next = obj->next_content;
extract_obj(obj);
}
if (ch->inRoom != NULL) {
char_from_room(ch);
}
/*
* Death room is set in the clan tabe now
*/
if (!fPull)
{
char_to_room(ch, get_room_by_id(DEFAULT_ROOM));
return;
}
UNLINK(first_character, Character, ch, next);
if (ch->pc) {
UNLINK(first_player, Character, ch, next_player);
}
destroy_char(ch);
}
示例6: close_archive
static void close_archive(FILE *archfp, FILE *outfp, FILE *dupfp) {
int last_errno;
if (fclose(archfp) != 0) {
note_archive_failure(outfp, last_errno = errno);
note_archive_failure(dupfp, last_errno);
if (outfp != stderr && dupfp != stderr)
note_archive_failure(stderr, last_errno);
return;
}
UNLINK(chkpnt_cfn);
UNLINK(chkpnt_tfn);
}
示例7: testReadWrite
static int
testReadWrite ()
{
char tmp[100 + 1];
int ret;
if (strlen (TESTSTRING) !=
GNUNET_DISK_fn_write (".testfile", TESTSTRING, strlen (TESTSTRING),
GNUNET_DISK_PERM_USER_READ |
GNUNET_DISK_PERM_USER_WRITE))
return 1;
if (GNUNET_OK != GNUNET_DISK_file_test (".testfile"))
return 1;
ret = GNUNET_DISK_fn_read (".testfile", tmp, sizeof (tmp) - 1);
if (ret < 0)
{
FPRINTF (stderr, "Error reading file `%s' in testReadWrite\n", ".testfile");
return 1;
}
tmp[ret] = '\0';
if (0 != memcmp (tmp, TESTSTRING, strlen (TESTSTRING) + 1))
{
FPRINTF (stderr, "Error in testReadWrite: *%s* != *%s* for file %s\n", tmp,
TESTSTRING, ".testfile");
return 1;
}
GNUNET_DISK_file_copy (".testfile", ".testfile2");
memset (tmp, 0, sizeof (tmp));
ret = GNUNET_DISK_fn_read (".testfile2", tmp, sizeof (tmp) - 1);
if (ret < 0)
{
FPRINTF (stderr, "Error reading file `%s' in testReadWrite\n",
".testfile2");
return 1;
}
tmp[ret] = '\0';
if (0 != memcmp (tmp, TESTSTRING, strlen (TESTSTRING) + 1))
{
FPRINTF (stderr, "Error in testReadWrite: *%s* != *%s* for file %s\n", tmp,
TESTSTRING, ".testfile2");
return 1;
}
GNUNET_break (0 == UNLINK (".testfile"));
GNUNET_break (0 == UNLINK (".testfile2"));
if (GNUNET_NO != GNUNET_DISK_file_test (".testfile"))
return 1;
return 0;
}
示例8: CTB_unlink
void CTB_unlink(char *name)
{
char str[MAXPATH], *p = ctb_last_punct(name);
if (p)
*p = '\0';
STRCPY(str, name);
STRCAT(str, ".CTB");
UNLINK(str);
STRCPY(str, name);
STRCAT(str, ".IND");
UNLINK(str);
return;
}
示例9: do_remcontract
void do_remcontract( CHAR_DATA * ch, char *argument )
{
CONTRACT_DATA *contract;
CONTRACT_DATA *scontract = NULL;
if( argument[0] == '\0' )
{
send_to_char( "&RSyntax: remcontract <target name>\n\r", ch );
return;
}
for( contract = ch->first_contract; contract; contract = contract->next_in_contract )
{
if( !str_cmp( contract->target, argument ) )
{
scontract = contract;
break;
}
}
if( !scontract || scontract == NULL )
{
send_to_char( "No such target.\n\r", ch );
return;
}
STRFREE( scontract->target );
UNLINK( scontract, ch->first_contract, ch->last_contract, next_in_contract, prev_in_contract );
DISPOSE( scontract );
send_to_char( "Contract removed.\n\r", ch );
return;
}
示例10: windowToValue
void CGridDlg::OnBnClickedButtonDiagram() {
if(!validate()) return;
windowToValue();
const GridParameters v = getCurrentValue();
PearlDiagram diagram;
PixRect *tmp = v.calculateImage(getImage(), &diagram);
SAFEDELETE(tmp);
const String dumpFileName = createTempFileName(_T("txt"));
FILE *f = NULL;
try {
const String dstr = diagram.toString();
f = MKFOPEN(dumpFileName,_T("w"));
_ftprintf(f, _T("%s"), dstr.cstr());
fclose(f); f = NULL;
ExternProcess::run(false, _T("c:\\windows\\system32\\notepad.exe"), dumpFileName.cstr(), NULL);
UNLINK(dumpFileName);
} catch (Exception e) {
if(f) { fclose(f); f = NULL; }
showException(e);
}
}
示例11: main
int
main (int argc, char *argv[])
{
int ret;
GNUNET_DISK_directory_remove ("/tmp/test-gnunet-hostlist-peer-1");
GNUNET_DISK_directory_remove ("/tmp/test-gnunet-hostlist-peer-2");
GNUNET_log_setup ("test-gnunet-daemon-hostlist",
"WARNING",
NULL);
#if !WINDOWS
system ("gnunet-peerinfo -s -c test_learning_adv_peer.conf > /dev/null");
system ("gnunet-peerinfo -s -c test_learning_learn_peer.conf > /dev/null");
#else
system ("gnunet-peerinfo -s -c test_learning_adv_peer.conf > NUL");
system ("gnunet-peerinfo -s -c test_learning_learn_peer.conf > NUL");
#endif
ret = check ();
GNUNET_DISK_directory_remove ("/tmp/test-gnunet-hostlist-peer-1");
GNUNET_DISK_directory_remove ("/tmp/test-gnunet-hostlist-peer-2");
if (GNUNET_YES == GNUNET_DISK_file_test ("hostlists_learn_peer.file"))
{
if (0 == UNLINK ("hostlists_learn_peer.file"))
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Hostlist file hostlists_learn_peer.file was removed\n");
}
return ret;
}
示例12: xlog_unlink
PRIVATE void xlog_unlink(xlog_s *xp)
{
xlog_s *server = xp->xl_use ;
/*
* Step 1: remove from server chain
*/
if ( server != XLOG_NULL )
{
if ( server->xl_clients == xp )
if ( NEXT( xp, xl_other_users ) == xp )
server->xl_clients = XLOG_NULL ;
else
server->xl_clients = NEXT( xp, xl_other_users ) ;
else
UNLINK( xp, xl_other_users ) ;
}
/*
* Step 2: If we have users, clear their link to us.
*/
if ( xp->xl_clients != NULL )
{
xlog_s *xp2 = xp->xl_clients ;
do
{
xp2->xl_use = XLOG_NULL ;
xp2 = NEXT( xp2, xl_other_users ) ;
}
while ( xp2 != xp->xl_clients ) ;
}
}
示例13: task_finished
static void
task_finished(isc_task_t *task) {
isc_taskmgr_t *manager = task->manager;
REQUIRE(EMPTY(task->events));
REQUIRE(EMPTY(task->on_shutdown));
REQUIRE(task->references == 0);
REQUIRE(task->state == task_state_done);
XTRACE("task_finished");
LOCK(&manager->lock);
UNLINK(manager->tasks, task, link);
#ifdef ISC_PLATFORM_USETHREADS
if (FINISHED(manager)) {
/*
* All tasks have completed and the
* task manager is exiting. Wake up
* any idle worker threads so they
* can exit.
*/
BROADCAST(&manager->work_available);
}
#endif /* ISC_PLATFORM_USETHREADS */
UNLOCK(&manager->lock);
DESTROYLOCK(&task->lock);
task->magic = 0;
isc_mem_put(manager->mctx, task, sizeof(*task));
}
示例14: VMCABackupFiles
static DWORD
VMCABackupFiles(
PCSTR pszBaseFilePath
)
{
DWORD dwError = ERROR_SUCCESS;
const DWORD MAX_NUMBER_OF_BAKUPS = 32;
struct STAT st = { 0 };
DWORD dwCounter;
PSTR pszDestFile = NULL;
PSTR pszSourceFile = NULL;
for (dwCounter = MAX_NUMBER_OF_BAKUPS; dwCounter > 0; --dwCounter)
{
dwError = VMCAAllocateStringPrintfA(
&pszDestFile,
"%s.%d",
pszBaseFilePath,
dwCounter);
BAIL_ON_ERROR(dwError);
if(STAT(pszDestFile, &st) == ERROR_SUCCESS )
{
UNLINK(pszDestFile);
}
dwError = VMCAAllocateStringPrintfA(
&pszSourceFile,
"%s.%d",
pszBaseFilePath,
dwCounter - 1);
BAIL_ON_ERROR(dwError);
RENAME(pszSourceFile, pszDestFile);
VMCA_SAFE_FREE_STRINGA(pszDestFile);
VMCA_SAFE_FREE_STRINGA(pszSourceFile);
pszDestFile = NULL;
pszSourceFile = NULL;
}
VMCA_SAFE_FREE_STRINGA(pszDestFile);
dwError = VMCAAllocateStringPrintfA(
&pszDestFile,
"%s.%d",
pszBaseFilePath,
0);
BAIL_ON_ERROR(dwError);
RENAME(pszBaseFilePath, pszDestFile);
error:
VMCA_SAFE_FREE_STRINGA(pszDestFile);
VMCA_SAFE_FREE_STRINGA(pszSourceFile);
return dwError;
}
示例15: while
void MatchGraph::UNPAIR_ALL ()
{
long u;
for (v=1; v <= U; ++v) {
if (BASE[(int)v] != v || LASTVTX[(int)v] == v)
continue;
nextu = v;
NEXTVTX[(int)LASTVTX[(int)nextu]] = DUMMYVERTEX;
while (1) {
u = nextu;
nextu = NEXTVTX[(int)nextu];
UNLINK (u);
if (LASTVTX[(int)u] != u) {
f = (LASTEDGE[2] == OPPEDGE(e)) ? LASTEDGE[1] : LASTEDGE[2];
NEXTVTX[(int)LASTVTX[(int)BEND(f)]] = u;
}
newbase = BMATE (BMATE(u));
if (newbase != DUMMYVERTEX && newbase != u) {
LINK[(int)u] = -DUMMYEDGE;
REMATCH (newbase, MATE[(int)u]);
}
while (LASTVTX[(int)nextu] == nextu && nextu != DUMMYVERTEX)
nextu = NEXTVTX[(int)nextu];
if (LASTVTX[(int)nextu] == nextu && nextu == DUMMYVERTEX)
break;
}
}
}