Exemplo n.º 1
0
void asCVariableScope::Reset()
{
	isBreakScope = false;
	isContinueScope = false;

	for( asUINT n = 0; n < variables.GetLength(); n++ )
		if( variables[n] ) 
		{
			DELETE(variables[n],sVariable);
		}
	variables.SetLength(0);
}
ADMVideoMPD3Dlow::~ADMVideoMPD3Dlow()
{

 	DELETE(_param);
	delete  _uncompressed;
	delete  _stored;
	delete [] Line;
	Line=NULL;
	_param=NULL;
	_uncompressed=NULL;
	_stored=NULL;
}
Exemplo n.º 3
0
void QGVector::clear()				// clear vector
{
    if ( vec ) {
	for ( uint i=0; i<len; i++ ) {		// delete each item
	    if ( vec[i] )
		deleteItem( vec[i] );
	}
	DELETE(vec);
	vec = 0;
	len = numItems = 0;
    }
}
Exemplo n.º 4
0
 void RedisReply::Clear()
 {
     type = 0;
     integer = 0;
     double_value = 0;
     str.clear();
     DELETE(elements);
     if (self_pool && NULL != pool)
     {
         pool->Clear();
     }
 }
Exemplo n.º 5
0
/**
 * postSort() runs after sorting has been performed. For ZendArray, postSort()
 * handles rewiring the linked list according to the results of the sort. Also,
 * if resetKeys is true, postSort() will renumber the keys 0 thru n-1.
 */
void ZendArray::postSort(Bucket** buffer, bool resetKeys) {
  uint last = m_size-1;
  m_pListHead = buffer[0];
  m_pListTail = buffer[last];
  m_pos = (ssize_t)m_pListHead;
  Bucket* b = buffer[0];
  b->pListLast = NULL;
  if (resetKeys) {
    memset(m_arBuckets, 0, tableSize() * sizeof(Bucket*));
    for (uint i = 0; i < last; ++i) {
      Bucket* bNext = buffer[i+1];
      b->pListNext = bNext;
      bNext->pListLast = b;
      if (b->hasStrKey() && b->skey->decRefCount() == 0) {
        DELETE(StringData)(b->skey);
      }
      b->setIntKey(i);
      uint nIndex = (i & m_nTableMask);
      CONNECT_TO_BUCKET_LIST(b, m_arBuckets[nIndex]);
      SET_ARRAY_BUCKET_HEAD(m_arBuckets, nIndex, b);
      b = bNext;
    }
    if (b->hasStrKey() && b->skey->decRefCount() == 0) {
      DELETE(StringData)(b->skey);
    }
    b->setIntKey(last);
    uint nIndex = (last & m_nTableMask);
    CONNECT_TO_BUCKET_LIST(b, m_arBuckets[nIndex]);
    SET_ARRAY_BUCKET_HEAD(m_arBuckets, nIndex, b);
    m_nNextFreeElement = m_size;
  } else {
    for (uint i = 0; i < last; ++i) {
      Bucket* bNext = buffer[i+1];
      b->pListNext = bNext;
      bNext->pListLast = b;
      b = bNext;
    }
  }
  b->pListNext = NULL;
}
Exemplo n.º 6
0
JILError JCLSetGlobalOptions(JILState* pVM, const JILChar* pOptionString)
{
	JILError err = JIL_No_Exception;
	JCLString* pStr;
	JCLString* pToken;
	JCLOption* pOptions;
	JCLState* _this;

	if( (_this = pVM->vmpCompiler) == NULL )
		return JIL_ERR_No_Compiler;

	pStr = NEW(JCLString);
	pToken = NEW(JCLString);
	JCLSetString(pToken, pOptionString);
	pOptions = GetGlobalOptions(_this);
	while( !JCLAtEnd(pToken) )
	{
		// copy up to separator into pStr
		JCLSpanExcluding(pToken, ",;", pStr);
		// trim any spaces
		JCLTrim(pStr);
		// something left?
		if( JCLGetLength(pStr) )
		{
			// have option object parse it
			err = pOptions->ParseOption(pOptions, pStr, JILHandleRuntimeOptions, pVM);
			// handle warnings and errors
			if( err )
				goto exit;
		}
		// skip the separator(s)
		JCLSpanIncluding(pToken, ",;", pStr);
	}

exit:
	DELETE(pStr);
	DELETE(pToken);
	return err;
}
Exemplo n.º 7
0
/* =============================================================================
 * rbtree_delete
 * -- Returns TRUE if key exists
 * =============================================================================
 */
bool_t
rbtree_delete (rbtree_t* r, void* key)
{
    node_t* node = NULL;
    node = LOOKUP(r, key);
    if (node != NULL) {
        node = DELETE(r, node);
    }
    if (node != NULL) {
        releaseNode(node);
    }
    return ((node != NULL) ? TRUE : FALSE);
}
Exemplo n.º 8
0
ASTNode* CNFMgr::doRenameITE(const ASTNode& varphi, ClauseList* defs)
{
    ASTNode psi;

    //########################################
    // step 1, old "RepLit" code
    //########################################

    ostringstream oss;
    oss << "cnf" << "{" << varphi.GetNodeNum() << "}";
    psi = bm->CreateSymbol(oss.str().c_str(),varphi.GetIndexWidth(),varphi.GetValueWidth());


    //########################################
    // step 3, recurse over children
    //########################################

    convertFormulaToCNF(varphi[0], defs);
    convertTermForCNF(varphi[1], defs);
    ASTNode t1 = *(info[varphi[1]]->termforcnf);
    convertTermForCNF(varphi[2], defs);
    ASTNode t2 = *(info[varphi[2]]->termforcnf);

    //########################################
    // step 4, add def clauses
    //########################################

    ClauseList* cl1 = SINGLETON(bm->CreateNode(EQ, psi, t1));
    ClauseList* cl2 = ClauseList::PRODUCT(*(info[varphi[0]]->clausesneg), *cl1);
    DELETE(cl1);
    defs->insert(cl2);

    ClauseList* cl3 = SINGLETON(bm->CreateNode(EQ, psi, t2));
    ClauseList* cl4 = ClauseList::PRODUCT(*(info[varphi[0]]->clausespos), *cl3);
    DELETE(cl3);
    defs->insert(cl4);

    return ASTNodeToASTNodePtr(psi);
}//End of doRenameITE()
Exemplo n.º 9
0
 RedisDumpFile* Slave::GetNewRedisDumpFile()
 {
     DELETE(m_rdb);
     std::string dump_file_path = m_serv->m_cfg.home + "/repl";
     char tmp[dump_file_path.size() + 100];
     uint32 now = time(NULL);
     sprintf(tmp, "%s/temp-%u-%u.rdb", dump_file_path.c_str(), getpid(), now);
     NEW(m_rdb, RedisDumpFile);
     m_rdb->Init(m_serv->m_db);
     m_rdb->OpenWriteFile(tmp);
     INFO_LOG("[Slave]Create redis dump file:%s", tmp);
     return m_rdb;
 }
Exemplo n.º 10
0
int sp_devices_length() {
    int length = 0;
    sp_db *th = NEW(sp_db);
    if (th && th->m_DB &&
        SQLITE_OK != sqlite3_exec(th->m_DB,
                                  "SELECT COUNT(id) as length FROM devices",
                                  &sp_devices_length_callback,
                                  (void *)&length, 0)) {
        length = 0;
    }
    DELETE(th);
    return length;
}
Exemplo n.º 11
0
	void LoadOperMOTD()
	{
		ConfigReader* conf = new ConfigReader(ServerInstance);
		std::string filename;
		filename = conf->ReadValue("opermotd","file",0);
		if (opermotd)
		{
			delete opermotd;
			opermotd = NULL;
		}
		opermotd = new FileReader(ServerInstance, filename);
		DELETE(conf);
	}
Exemplo n.º 12
0
void ZendArray::onSetEvalScalar() {
  for (Bucket *p = m_pListHead; p; p = p->pListNext) {
    StringData *key = p->skey;
    if (p->hasStrKey() && !key->isStatic()) {
      StringData *skey= StringData::GetStaticString(key);
      if (key && key->decRefCount() == 0) {
        DELETE(StringData)(key);
      }
      p->skey = skey;
    }
    p->data.setEvalScalar();
  }
}
Exemplo n.º 13
0
	void ReadConfig()
	{
		ConfigReader* MyConf = new ConfigReader(ServerInstance);
		allowchans.clear();
		for (int i = 0; i < MyConf->Enumerate("allowchannel"); i++)
		{
			std::string txt;
			txt = MyConf->ReadValue("allowchannel", "name", i);
			irc::string channel = txt.c_str();
			allowchans[channel] = 1;
		}
		DELETE(MyConf);
	}
Exemplo n.º 14
0
HOT_FUNC_HPHP
void ZendArray::erase(Bucket ** prev, bool updateNext /* = false */) {
  if (prev == NULL)
    return;
  Bucket * p = *prev;
  bool nextElementUnsetInsideForeachByReference = false;
  if (p) {
    *prev = p->pNext;
    if (p->pListLast) {
      p->pListLast->pListNext = p->pListNext;
    } else {
      /* Deleting the head of the list */
      ASSERT(m_pListHead == p);
      m_pListHead = p->pListNext;
    }
    if (p->pListNext) {
      p->pListNext->pListLast = p->pListLast;
    } else {
      ASSERT(m_pListTail == p);
      m_pListTail = p->pListLast;
    }
    if (m_pos == (ssize_t)p) {
      m_pos = (ssize_t)p->pListNext;
    }
    int sz = m_strongIterators.size();
    for (int i = 0; i < sz; ++i) {
      if (m_strongIterators.get(i)->pos == (ssize_t)p) {
        nextElementUnsetInsideForeachByReference = true;
        m_strongIterators.get(i)->pos = (ssize_t)p->pListNext;
        if (!(m_strongIterators.get(i)->pos)) {
          // Record that there is a strong iterator out there
          // that is past the end
          m_flag |= StrongIteratorPastEnd;
        }
      }
    }
    m_size--;
    // Match PHP 5.3.1 semantics
    if ((uint64)p->ikey == (uint64)(m_nNextFreeElement - 1) &&
        (p->ikey == 0x7fffffffffffffffLL || updateNext)) {
      --m_nNextFreeElement;
    }
    DELETE(Bucket)(p);
  }
  if (nextElementUnsetInsideForeachByReference) {
    if (RuntimeOption::EnableHipHopErrors) {
      raise_warning("The next element was unset inside foreach by reference. "
                    "This may lead to unexpeced results.");
    }
  }
}
Exemplo n.º 15
0
int32 main()
{    
    CTest *p1, *p2, *p3;
    char* pch1;
	CMemMgr* pclMemMgr = TSingleton<CMemMgr>::Instance();
    TSingleton<CMutexMgr>::Instance()->Init();    

    pclMemMgr.Init();
	pclMemMgr.Dump(NULL);
    NEW(p1, CTest, 1, 1);    
    NEW(p2, CTest, 2, 2);
    NEW(p3, CTest, 3, 3);
    p1->print();
    p2->print();
    p3->print();
	pclMemMgr.Dump(NULL);
    
    DELETE(p1);    
    MALLOC(pch1, char, 10);
    p2->print();
    p3->print();
	pclMemMgr.Dump(NULL);

    FREE(pch1);
    DELETE(p2);    
    DELETE(p3);
	pclMemMgr.Dump(NULL);
    
	pthread_t m_resumeThreadId;
    pthread_create(&m_resumeThreadId, 0, ResumeMemTask, 0);
    
	pthread_t m_monitorThreadId;
    pthread_create(&m_monitorThreadId, 0, MonitorMemTask, 0);
	
    while(1) sleep(10);

	return 0;
}
Exemplo n.º 16
0
 int LMDBEngine::DiscardBatchWrite()
 {
     LMDBContext& holder = m_ctx_local.GetValue();
     holder.batch_write--;
     if (holder.batch_write == 0)
     {
         CheckPointOperation* ck = new CheckPointOperation(holder.cond);
         m_write_queue.Push(ck);
         NotifyBackgroundThread();
         ck->Wait();
         DELETE(ck);
     }
     return 0;
 }
Exemplo n.º 17
0
	void OnCleanup(int target_type, void* item)
	{
		if(target_type == TYPE_USER)
		{
			userrec* user = (userrec*)item;
			BlockedMessage* m;
			user->GetExt("amsgblock", m);
			if(m)
			{
				DELETE(m);
				user->Shrink("amsgblock");
			}
		}
	}
Exemplo n.º 18
0
void CDlnaFrame::Release()
{
	CListPlugin::iterator itbegin = m_ListPlugin.begin();
	CListPlugin::iterator itend = m_ListPlugin.end();
	for (itbegin;itbegin!=itend;++itbegin)
	{
		CPlugIn *pPlugin = (CPlugIn*)(*itbegin);
		/*if(pPlugin->pHandle)
			dlclose(pPlugin->pHandle);*/
		DELETE(pPlugin);
	}
	
	m_ListPlugin.clear();
}
Exemplo n.º 19
0
void MainTest::deletePost()
{
    auto count = FROM(db.posts())
            WHERE(Post::idField() == postId)
            DELETE();

    QTEST_ASSERT(count == 1);

    count = FROM(db.posts())
            WHERE(Post::idField() == postId)
            COUNT();

    QTEST_ASSERT(count == 0);
}
Exemplo n.º 20
0
void CNFMgr::reduceMemoryFootprintNeg(const ASTNode& varphi)
{
    CNFInfo* x = info[varphi];
    if (sharesNeg(*x) == 1)
    {
        DELETE(x->clausesneg);
        x->clausesneg = NULL;
        if (x->clausespos == NULL)
        {
            delete x;
            info.erase(varphi);
        }
    }
} //End of reduceMemoryFootprintNeg()
Exemplo n.º 21
0
/*
in :
    - attribute is the attribute that is tested in the node that's going to be created
out :
    - the non-leaf node
*/
static struct node_t *new_node(const struct attribute_t *attribute)
{
    int i;
    struct node_t *ret = malloc(sizeof(*ret));
    ret->nb_children = attribute->l_tab;
    ret->children = malloc(sizeof(*ret->children) * ret->nb_children);
    for(i = 0; i < ret->nb_children; ++i)
        ret->children[i] = NULL;
    ret->attribute_values = malloc(sizeof(*ret->attribute_values) * ret->nb_children);
    for(i = 0; i < ret->nb_children; ++i)
        DELETE(ret->attribute_values[i]);
    strcpy(ret->property.name_attribute, attribute->property);
    return ret;
}
Exemplo n.º 22
0
void  CHandleOutSearch::SendRequest(const TDesC8& aUrl)
{
	DELETE(iCurUrl);
	iCurUrl=aUrl.Alloc();
	if(CheckTemp())
	{
		iState=EHttpOutSearch;
		iHttpManager.SendGetRequest(*this,aUrl,EHttpOutSearch);
	}
	else
	{
		iObserver.HandleResponseEvent(0,EHttpOutSearch);
	}
}
Exemplo n.º 23
0
/**
 * SceneNode deconstructor.
 * @param node The node to free.
 * \memberof SceneNode
 */
void SceneNode_0SceneNode(SceneNode *node) {
	DEBUG_M("Entering function...");
	assert(node);

	#warning ['TODO']: Free SceneNode memory recusivly, right now it leaks...

	DEBUG_H("Deleting mesh...");
	DELETE(node->mesh);
	node->mesh = NULL;

	DEBUG_H("Deleting Child node...");
	DELETE(node->child);
	DEBUG_H("Deleting next node...");
	DELETE(node->next);	

	DEBUG_H("Deleting rotations...");
	List_DeleteData(node->rotations);
	DELETE(node->rotations);
	node->rotations = NULL;

	DEBUG_H("Deleting self...");
	free(node);
}
Exemplo n.º 24
0
Arquivo: ardb.cpp Projeto: Ivasek/ardb
	int Ardb::LastDB(DBID& db)
	{
		int ret = -1;
		Iterator* iter = NewIterator(ARDB_GLOBAL_DB);
		if (NULL != iter && iter->Valid())
		{
			//Skip last KEY_END entry
			iter->Prev();
		}
		if (NULL != iter && iter->Valid())
		{
			Slice tmpkey = iter->Key();
			KeyObject* kk = decode_key(tmpkey, NULL);
			if (NULL != kk)
			{
				db = kk->db;
				ret = 0;
			}
			DELETE(kk);
		}
		DELETE(iter);
		return ret;
	}
Exemplo n.º 25
0
Document *
populate(getc_func getc, void* ctx, int flags)
{
    Cstring line;
    Document *a = new_Document();
    int c;
    int pandoc = 0;

    if ( !a ) return 0;

    a->tabstop = (flags & MKD_TABSTOP) ? 4 : TABSTOP;

    CREATE(line);

    while ( (c = (*getc)(ctx)) != EOF ) {
	if ( c == '\n' ) {
	    if ( pandoc != EOF && pandoc < 3 ) {
		if ( S(line) && (T(line)[0] == '%') )
		    pandoc++;
		else
		    pandoc = EOF;
	    }
	    queue(a, &line);
	    S(line) = 0;
	}
	else if ( isprint(c) || isspace(c) || (c & 0x80) )
	    EXPAND(line) = c;
    }

    if ( S(line) )
	queue(a, &line);

    DELETE(line);

    if ( (pandoc == 3) && !(flags & (MKD_NOHEADER|MKD_STRICT)) ) {
	/* the first three lines started with %, so we have a header.
	 * clip the first three lines out of content and hang them
	 * off header.
	 */
	Line *headers = T(a->content);

	a->title = headers;             header_dle(a->title);
	a->author= headers->next;       header_dle(a->author);
	a->date  = headers->next->next; header_dle(a->date);

	T(a->content) = headers->next->next->next;
    }

    return a;
}
Exemplo n.º 26
0
void f() {
    int *a = new int(5); // expected-note2 {{allocated with 'new' here}}
    delete[] a;          // expected-warning {{'delete[]' applied to a pointer that was allocated with 'new'; did you mean 'delete'?}}
    int *b = new int;
    delete b;
    int *c{new int};    // expected-note {{allocated with 'new' here}}
    int *d{new int[1]}; // expected-note2 {{allocated with 'new[]' here}}
    delete  [    ] c;   // expected-warning {{'delete[]' applied to a pointer that was allocated with 'new'; did you mean 'delete'?}}
    // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:9-[[@LINE-1]]:17}:""
    delete d;           // expected-warning {{'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'?}}
    // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:9-[[@LINE-1]]:9}:"[]"
    DELETE_ARRAY(a);    // expected-warning {{'delete[]' applied to a pointer that was allocated with 'new'; did you mean 'delete'?}}
    DELETE(d);          // expected-warning {{'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'?}}
}
Exemplo n.º 27
0
node  Delete_Element(tree t, node Parent, void * data, int *H, int * found, void * found_data)
{
    node Temp;
    if(!Parent)
    {
        printf("\n datarmation does not exist");
        return(Parent);
    }
    else
    {
        if (t->comp(data, Parent->data) < 0)
        {
            Parent->left = Delete_Element(t, Parent->left, data, H, found, found_data);
            if(*H)
                Parent = Balance_Right_Heavy(Parent, H);
        }
        else if(t->comp(data, Parent->data) > 0)
        {
            Parent->right = Delete_Element(t, Parent->right, data, H, found, found_data);
            if(*H)
                Parent = Balance_Left_Heavy(Parent, H);
        }
        else
        {
            *found = 1;
            *((int*)found_data) = (int) Parent->data;
            Temp= Parent;

            if(Temp->right == NULL)
            {
                Parent = Temp->left;
                *H = T;
                free(Temp);
            }
            else if(Temp->left == NULL)
            {
                Parent = Temp->right;
                *H = T;
                free(Temp);
            }
            else
            {
                Temp->left = DELETE(Temp->left, Temp, H);
                if(*H)
                    Parent = Balance_Right_Heavy(Parent, H);
            }
        }
    }
    return(Parent);
}
CSearchResultView::~CSearchResultView()
{
	DELETE(iTitle);
	DELETE(iInSearch);
	DELETE(iShowInfo);
	DELETE(iShowGrade);
	DELETE(iUrl);
	DELETE(iTempBuf);	
}
Exemplo n.º 29
0
//From MOperationObserver
void CHandleOutSearch::OperationEvent(TInt aEventType,const TDesC& aEventData,TInt aType)
{
	TInt eventType=aEventType;

	if(aEventType==EHttpNoError)
	{
		if(aType==EHttpOutSearch)
		{
			::WriteFile(iFileName,aEventData);
			this->HandlePageWml();
		}
		else if(aType==EHttpOutSearchError)
		{
			DELETE(iErrorInfo);
			iErrorInfo=aEventData.Alloc();

			DELETE(iBuf);
			iBuf=aEventData.Alloc();
			eventType=EHttpContentError;
		}
	}
	else
	{
		DELETE(iBuf);
		iBuf=aEventData.Alloc();
	}
	if(aType!=EHttpOutSearchKeyWord)
	{
		if(iContentError)
		{
			iObserver.HandleResponseEvent(EHttpContentError,aType);
			iContentError=EFalse;
		}
		else
			iObserver.HandleResponseEvent(eventType,aType);
	}
}
Exemplo n.º 30
0
Arquivo: m4.c Projeto: collects/m4
void
m4_delete (m4 *context)
{
  size_t i;
  assert (context);

  if (context->symtab)
    m4_symtab_delete (context->symtab);

  if (context->syntax)
    m4_syntax_delete (context->syntax);

  /* debug_file should have been reset to stdout or stderr, both of
     which are closed later.  */
  assert (context->debug_file == stderr || context->debug_file == stdout);

  obstack_free (&context->trace_messages, NULL);

  if (context->search_path)
    {
      m4__search_path *path = context->search_path->list;

      while (path)
        {
          m4__search_path *stale = path;
          path = path->next;

          DELETE (stale->dir); /* Cast away const.  */
          free (stale);
        }
      free (context->search_path);
    }

  for (i = 0; i < context->stacks_count; i++)
    {
      assert (context->arg_stacks[i].refcount == 0
              && context->arg_stacks[i].argcount == 0);
      if (context->arg_stacks[i].args)
        {
          obstack_free (context->arg_stacks[i].args, NULL);
          free (context->arg_stacks[i].args);
          obstack_free (context->arg_stacks[i].argv, NULL);
          free (context->arg_stacks[i].argv);
        }
    }
  free (context->arg_stacks);

  free (context);
}