TypedList *new_TypedList( void ) { TypedList *result = ( TypedList * ) calloc( 1, sizeof( TypedList ) ); CHECK_PTR(result); result->name = NULL; result->type = NULL; result->n = -1; return result; }
bool SGFParser::exportSGFtoClipB(QString *str, Tree *tree) { CHECK_PTR(tree); if (stream != NULL) delete stream; stream = new QTextStream(str, IO_WriteOnly); bool res = writeStream(tree); delete stream; stream = NULL; return res; }
StoneHandler::StoneHandler(BoardHandler *bh) : boardHandler(bh) { CHECK_PTR(boardHandler); stones = new QIntDict<Stone>(367); // prime number larger than 361 (19*19) // TODO: Dynamic for different board size? stones->setAutoDelete(TRUE); groups = new QPtrList<Group>; groups->setAutoDelete(TRUE); workingOnNewMove = false; }
void SensorCard::displayNowHeader(Args& args) { const char* delimiter; delimiter = args.getDelimiter(); CHECK_PTR(delimiter); printf("Chan. 1 Temperature now%s", delimiter); printf("Chan. 2 Temperature now%s", delimiter); printf("Irradiance now%s", delimiter); printf("Chan. 1 Value now%s", delimiter); printf("Chan. 2 Value now%s", delimiter); }
bool xmp_files_close(XmpFilePtr xf, XmpCloseFileOptions options) { CHECK_PTR(xf, false); RESET_ERROR; try { SXMPFiles *txf = (SXMPFiles*)xf; txf->CloseFile(options); } catch(const XMP_Error & e) { set_error(e); return false; } return true; }
bool xmp_files_free(XmpFilePtr xf) { CHECK_PTR(xf, false); RESET_ERROR; SXMPFiles *txf = (SXMPFiles*)xf; try { delete txf; } catch(const XMP_Error & e) { set_error(e); return false; } return true; }
QGCache::QGCache( int maxCost, uint size, KeyType kt, bool caseSensitive, bool copyKeys ) { keytype = kt; lruList = new QCList; CHECK_PTR( lruList ); lruList->setAutoDelete( TRUE ); copyk = ((keytype == AsciiKey) && copyKeys); dict = new QCDict( size, kt, caseSensitive, FALSE ); CHECK_PTR( dict ); mCost = maxCost; tCost = 0; #if defined(DEBUG) lruList->inserts = 0; lruList->insertCosts = 0; lruList->insertMisses = 0; lruList->finds = 0; lruList->hits = 0; lruList->hitCosts = 0; lruList->dumps = 0; lruList->dumpCosts = 0; #endif }
XmpFilePtr xmp_files_open_new(const char *path, XmpOpenFileOptions options) { CHECK_PTR(path, NULL); RESET_ERROR; SXMPFiles *txf = NULL; try { txf = new SXMPFiles(path, XMP_FT_UNKNOWN, options); } catch(const XMP_Error & e) { set_error(e); } return (XmpFilePtr)txf; }
BfsHashEntry *new_BfsHashEntry( void ) { BfsHashEntry *result = ( BfsHashEntry * ) calloc( 1, sizeof( BfsHashEntry ) ); CHECK_PTR(result); result->bfs_node = NULL; result->next = NULL; return result; }
EhcHashEntry *new_EhcHashEntry( void ) { EhcHashEntry *result = ( EhcHashEntry * ) calloc( 1, sizeof( EhcHashEntry ) ); CHECK_PTR(result); result->ehc_node = NULL; result->next = NULL; return result; }
Facts *new_Facts( void ) { Facts *result = ( Facts * ) calloc( 1, sizeof( Facts ) ); CHECK_PTR(result); result->fact = new_Fact(); result->next = NULL; return result; }
EasyTemplate *new_EasyTemplate( NormOperator *op ) { EasyTemplate *result = ( EasyTemplate * ) calloc( 1, sizeof( EasyTemplate ) ); CHECK_PTR(result); result->op = op; result->prev = NULL; result->next = NULL; return result; }
NumericEffect *new_NumericEffect( void ) { NumericEffect *result = ( NumericEffect * ) calloc( 1, sizeof( NumericEffect ) ); CHECK_PTR(result); result->rh = NULL; result->next = NULL; result->prev = NULL; return result; }
ParseExpNode *new_ParseExpNode( ExpConnective c ) { ParseExpNode *result = ( ParseExpNode * ) calloc( 1, sizeof( ParseExpNode ) ); CHECK_PTR(result); result->connective = c; result->atom = NULL; result->leftson = NULL; result->rightson = NULL; return result; }
/******************************************************************************************* * NAME : input_parse * * DESCRIPTION : Parses the input from a file of the cnf sat form. * * INPUTS : * PARAMETERS : * FILE *fp file * INPUT *input input * * OUTPUTS : * RETURN : 1 on success, -1 on failure/error */ int input_parser(FILE *fp, INPUT *input) { int i, file_size, *nbvar, *nbclauses, **data, *clause_lengths, *pos_val_sums, *neg_val_sums; char *line; // Finding the size of the file in bytes. file_size = get_file_size(fp); // Pass over comments. line = parse_comments(fp, file_size); nbvar = malloc(sizeof(int)); // ndicates variables will be from [-1, -nbvar] and [1, nbvar]. CHECK_PTR(nbvar); *nbvar = 0; nbclauses = malloc(sizeof(int)); // indicates the number of rows (clauses), indicated by the number of zeros. CHECK_PTR(nbclauses); *nbclauses = 0; if (parse_cnf_header(line, nbvar, nbclauses) != 1) { return -1; } data = malloc(sizeof(int*) * (*nbclauses)); CHECK_PTR(data); clause_lengths = malloc(sizeof(int) * (*nbclauses)); CHECK_PTR(clause_lengths); pos_val_sums = malloc(sizeof(int) * ((*nbvar))); CHECK_PTR(pos_val_sums); neg_val_sums = malloc(sizeof(int) * ((*nbvar))); CHECK_PTR(neg_val_sums); // Load array with 0s. for (i = 0; i < *nbvar; i++) { pos_val_sums[i] = 0; neg_val_sums[i] = 0; } // Loops over all clauses. if (parse_clauses(fp, file_size, data, nbclauses, clause_lengths, pos_val_sums, neg_val_sums) != 1) { return -1; } // Load values into structs. input->data = data; input->nbclauses = *nbclauses; input->nbvars = *nbvar; input->clause_lengths = clause_lengths; input->pos_val_sums = pos_val_sums; input->neg_val_sums = neg_val_sums; free(nbvar); free(nbclauses); return 1; }
PlOperator *new_PlOperator( char *name ) { PlOperator *result = ( PlOperator * ) calloc( 1, sizeof( PlOperator ) ); CHECK_PTR(result); if ( name ) { result->name = new_Token(strlen(name)+1); CHECK_PTR(result->name); strcpy(result->name, name); } else { result->name = NULL; } result->params = NULL; result->preconds = NULL; result->effects = NULL; result->number_of_real_params = 0; result->next = NULL; return result; }
QMenuData::QMenuData() { actItem = -1; // no active menu item mitems = new QMenuItemList; // create list of menu items CHECK_PTR( mitems ); mitems->setAutoDelete( TRUE ); parentMenu = 0; // assume top level isPopupMenu = FALSE; isMenuBar = FALSE; mouseBtDn = FALSE; badSize = TRUE; avoid_circularity = 0; actItemDown = FALSE; d = new QMenuDataData; }
EhcNode *new_EhcNode( void ) { EhcNode *result = ( EhcNode * ) calloc( 1, sizeof( EhcNode ) ); CHECK_PTR(result); make_state( &(result->S), gnum_ft_conn, gnum_fl_conn ); result->father = NULL; result->next = NULL; return result; }
LnfExpNode *new_LnfExpNode( void ) { LnfExpNode *result = ( LnfExpNode * ) calloc( 1, sizeof( LnfExpNode ) ); CHECK_PTR(result); result->num_pF = 0; result->num_nF = 0; result->c = 0; return result; }
void RS_Engine::start(bool autoplay) { qDebug("start"); ASSERT( !autoplay ); CHECK_PTR( timer ); if( timer->isActive() ) { timer->stop(); } new_block(); updateUI(); timer->start(1000); }
Action *new_Action( void ) { Action *result = ( Action * ) calloc( 1, sizeof( Action ) ); CHECK_PTR(result); result->norm_operator = NULL; result->pseudo_action = NULL; result->next = NULL; return result; }
XmpFileType xmp_files_check_file_format(const char *filePath) { CHECK_PTR(filePath, XMP_FT_UNKNOWN); RESET_ERROR; XmpFileType file_type = XMP_FT_UNKNOWN; try { file_type = (XmpFileType)SXMPFiles::CheckFileFormat(filePath); } catch(const XMP_Error & e) { set_error(e); return XMP_FT_UNKNOWN; } return file_type; }
BfsNode *new_BfsNode( void ) { BfsNode *result = ( BfsNode * ) calloc( 1, sizeof( BfsNode ) ); CHECK_PTR(result); result->father = NULL; result->next = NULL; result->prev = NULL; return result; }
XmpPtr xmp_new(const char *buffer, size_t len) { CHECK_PTR(buffer, NULL); RESET_ERROR; SXMPMeta *txmp; try { txmp = new SXMPMeta(buffer, len); } catch(const XMP_Error & e) { set_error(e); txmp = 0; } return (XmpPtr)txmp; }
PlNode *new_PlNode( Connective c ) { PlNode *result = ( PlNode * ) calloc( 1, sizeof( PlNode ) ); CHECK_PTR(result); result->connective = c; result->atom = NULL; result->sons = NULL; result->next = NULL; return result; }
/** Execute the bottomUp operator */ void INode::execBottomUp() { #ifdef DEBUGMSG qDebug("#* INode::execBottomUp(%s)(%p): Start\n", (const char *) name(), this); #endif if (analysis()->error()) { status(BU_ABORTED); return; } execState(BU); CHECK_PTR(this->sNode()); if (sNode_) sNode_->execBottomUpOp(this); //start BU }
static void bio_callback(struct bio *bio, int code) #endif // end_remove_this { struct bio_mref_aspect *mref_a = bio->bi_private; struct bio_brick *brick; unsigned long flags; CHECK_PTR(mref_a, err); CHECK_PTR(mref_a->output, err); brick = mref_a->output->brick; CHECK_PTR(brick, err); // remove_this #ifdef HAS_BI_ERROR // end_remove_this mref_a->status_code = bio->bi_error; // remove_this #else mref_a->status_code = code; #endif // end_remove_this spin_lock_irqsave(&brick->lock, flags); list_del(&mref_a->io_head); list_add_tail(&mref_a->io_head, &brick->completed_list); atomic_inc(&brick->completed_count); spin_unlock_irqrestore(&brick->lock, flags); wake_up_interruptible(&brick->response_event); return; err: MARS_FAT("cannot handle bio callback\n"); }
void DrawView::changeToJulia() { if ( last_fract != FJulia ) { last_fract = FJulia; if ( fract != NULL ) { delete fract; } fract = new Julia(); CHECK_PTR( fract ); resetOnChange(); param_1 = JULIA_X; param_2 = JULIA_Y; } }
route * r3_route_createl(const char * path, int path_len) { route * info = zmalloc(sizeof(route)); CHECK_PTR(info); info->path = (char*) path; info->path_len = path_len; info->request_method = 0; // can be (GET || POST) info->data = NULL; info->host = NULL; // required host name info->host_len = 0; info->remote_addr_pattern = NULL; info->remote_addr_pattern_len = 0; return info; }
void DrawView::changeToMandel() { if ( last_fract != FMandel ) { last_fract = FMandel; if ( fract != NULL ) { delete fract; } fract = new Mandel(); CHECK_PTR( fract ); resetOnChange(); param_1 = 0.0; param_2 = 0.0; } }