Example #1
0
File: file.c Project: chenguo/parsh
/* Remove a command from the file hash table. */
void
file_command_remove (struct command* command, int status)
{
  DBG("FILE REMOVE COMMAND: CMD %p  status %d\n", command, status);
  FILE_LOCK;
  struct redir *redirs = ct_extract_redirs (command->cmdtree);

  /* For each file. */
  while (redirs)
    {
      DBG("FILE REMOVE COMMAND: file: %s\n", redirs->file);

      /* Find the file being accessed. */
      struct file *file = *file_find (file_hash (redirs->file), redirs->file);
      if (!file)
        DBG("FILE REMOVE COMMAND: error: file not hashed\n");

      /* Remove command as an accessor to the file. */
      file_file_remove_accessor (file, command);

      redirs = redirs->next;
    }
  command->status = status;
  ct_free (command);

  FILE_UNLOCK;
}
void
ct_move_generator_free(CtMoveGenerator move_generator)
{
  ct_piece_mgs_free(move_generator->white_piece_mgs);
  ct_piece_mgs_free(move_generator->black_piece_mgs);
  ct_free(move_generator);
}
Example #3
0
static PGPError
Teardown (PGPPipeline *myself)
{
	DefModContext *context;
	PGPContextRef	cdkContext;
	
	pgpAssertAddrValid( myself, PGPPipeline );
	cdkContext	= myself->cdkContext;

	pgpAssert (myself);
	pgpAssert (myself->magic == DEFMODMAGIC);

	context = (DefModContext *)myself->priv;
	pgpAssert (context);

	if (context->tail)
		context->tail->teardown (context->tail);

	bi_free (context->zbcontext);		/* Free bits data structures */
	ct_free (context->ztcontext);		/* Free code tree buffers */
	lm_free (context->zdcontext);		/* Free longest match buffers */
	byteFifoDestroy (context->fifo);
	
	pgpClearMemory( context,  sizeof (*context));
	pgpContextMemFree( cdkContext, context);

	return kPGPError_NoErr;
}
Example #4
0
void CtSelector_Delete(CtSelector *thiz)
{
    RETURN_IF_FAIL(thiz);

    CtSelector_Dispose(thiz);
    ct_free(thiz);
}
Example #5
0
void CtCondition_Delete(CtCondition *thiz)
{
    RETURN_IF_FAIL(thiz);

    CtCondition_NotifyAll(thiz);
    CtCondition_Dispose(thiz);
    ct_free(thiz);
}
static void
ct_piece_mgs_free(CtPieceMovers piece_mgs)
{
  ct_pawn_free(piece_mgs->pawn);
  ct_steper_free(piece_mgs->stepers[0]);
  ct_steper_free(piece_mgs->stepers[1]);
  ct_slider_free(piece_mgs->sliders[0]);
  ct_slider_free(piece_mgs->sliders[1]);
  ct_slider_free(piece_mgs->sliders[2]);
  ct_free(piece_mgs);
}
Example #7
0
static CtRet udp_join_multicast_group_with_all_ip(int fd, const char *group)
{
    IP_ADAPTER_INFO * pNextAdapter = NULL;
    IP_ADAPTER_INFO * ipAdaptersInfo = NULL;
    ULONG infolen = sizeof(IP_ADAPTER_INFO);

    ipAdaptersInfo = (IP_ADAPTER_INFO *)ct_malloc(infolen);

    if (GetAdaptersInfo(ipAdaptersInfo, &infolen) == ERROR_BUFFER_OVERFLOW)
    {
        ct_free(ipAdaptersInfo);
        ipAdaptersInfo = (IP_ADAPTER_INFO *)ct_malloc(infolen);
    }

    if (GetAdaptersInfo(ipAdaptersInfo, &infolen))
    {
        ct_free(ipAdaptersInfo);
        return CT_RET_E_INTERNAL;
    }

    for (pNextAdapter = ipAdaptersInfo; pNextAdapter; pNextAdapter = pNextAdapter->Next)
    {
        IP_ADDR_STRING *pNextIp = NULL;
        for (pNextIp = &(pNextAdapter->IpAddressList); pNextIp; pNextIp = pNextIp->Next)
        {
            unsigned long ip = inet_addr(pNextIp->IpAddress.String);
            if (ip == 0)
            {
                break;
            }

            LOG_D(TAG, "join MultiGroup ip: %s", pNextIp->IpAddress.String);

            udp_join_multicast_group_with_ip(fd, group, ip);
        }
    }

    ct_free(ipAdaptersInfo);

    return CT_RET_OK;
}
Example #8
0
static void
_test_imglist(const char *vname) {
    struct ct_t **pcts;
    CvRect *objects;
    int n = 0;
    int i;
    const int gray_mode = 0;

    ImgQueue queue;
    IplImage *gray = 0;

    queue.open(vname);
    gray = queue.nextImg(gray_mode);
  
    n = _get_regions(gray, &objects);

    if (n < 1) {
	cvReleaseImage(&gray);
	return ;
    }

    pcts = (struct ct_t **)malloc(n * sizeof(struct ct_t **));
    for (i = 0; i < n; ++i) {
	pcts[i] = ct_new();
	ct_init(pcts[i], gray, &objects[i]);
    }

    cvNamedWindow("tracking", 1);
    while ( gray = queue.nextImg(gray_mode) ) {

#define _draw(f, r)						\
	cvRectangle(f, cvPoint((r).x, (r).y),			\
		    cvPoint((r).x+(r).width, (r).y+(r).height), \
		    cvScalar(255,255,255,0), 2,8,0)
	
	for (i = 0; i < n; ++i) {
	    ct_update(pcts[i], gray, &objects[i]);
	    _draw(gray, objects[i]);
	}
	
	cvShowImage("tracking", gray);
	if (27 == cvWaitKey(1)) break;
    }
#undef _draw
    
    cvDestroyWindow("tracking");
    
    for (i = 0; i < n; ++i) {
	ct_free( &pcts[i] );
    }
    free( pcts );
    free( objects );
}
Example #9
0
void CtThread_Delete(CtThread *thiz)
{
    CtThread_Dispose(thiz);
    ct_free(thiz);
}
static void
ct_pgn_reader_free(CtPgnReader pgn_reader)
{
  yylex_destroy(pgn_reader->pgn_scanner);
  ct_free(pgn_reader);
}