/* Puts element in front of the list. * Gets the original list and element to add. * Returns new list. */ static NODE* AddToList(NODE *list, /* write-only original list */ int row, /* row from cell to add */ int col) /* column from cell to add */ { NODE *c; #ifdef NEVER if(InList(list, row, col)) /* CW not neccessary when * building initial list */ return list; # endif if (Set1BitMatrix(inList, row,col)) /* already in list */ return list; c = NewNode(row,col); if(c == NULL) { list = FreeList(list); return NULL; /* allocation error */ } /* initialize node, row,col set in NewNode */ c->prev = NULL; if(list == NULL) list = firstOfList = c; /* first element in list */ else { firstOfList->prev = c; /* put in front of 1st element */ firstOfList = c; } return list; }
UpdateAlgorithmArguments::~UpdateAlgorithmArguments() { if (InList()) Out(); if (m_owner) m_owner->SetRestartArguments(NULL); }
PKCS_11_Token::~PKCS_11_Token() { OP_ASSERT(Get_Reference_Count() == 0); CloseSession(); if(InList()) Out(); }
void main(void) { char *res; char valeurs[300]; sprintf(valeurs,"chaine 1\nchaine 2\nchaine 3\nchaine 4\nchaine 5\nchaine 6\nchaine 7\nchaine 8\nchaine 9\nchaine 10\n"); res=InList("chaine 23",valeurs,'\0'); printf("Resultat %s\n",res); free(res); }
void HEListElm::SetDelayLoad(BOOL v) { if (static_cast<BOOL>(delay_load) != v) { delay_load = v; if (InList()) GetLoadInlineElm()->CheckDelayLoadState(); } }
void FTP_Request::InternalDestruct() { if(InList()) Out(); if(ftp_conn) { ftp_conn->Stop(); } password.Wipe(); }
FTP_Connection::~FTP_Connection() { if(InList()) Out(); if(conn) { //conn->EndLoading(); conn->Stop(); SComm::SafeDestruction(conn); conn = NULL; } }
NTSTATUS SoundInitInterrupt( IN OUT PGLOBAL_DEVICE_INFO pGDI, IN OUT PULONG Interrupt ) { NTSTATUS Status; ULONG CurrentInterrupt; int i; static CONST ULONG InterruptChoices[] = VALID_INTERRUPTS; // // Make sure the one given really is in the list // if (!InList(InterruptChoices, *Interrupt)) { return STATUS_DEVICE_CONFIGURATION_ERROR; } // // First check the interrupt we were given // If this fails check them all // for (i = 0, CurrentInterrupt = *Interrupt; CurrentInterrupt != 0xFFFF; // 0xFFFF is terminator CurrentInterrupt = InterruptChoices[i], i++) { Status = SoundInterruptValid(pGDI, &CurrentInterrupt); if (NT_SUCCESS(Status)) { if (*Interrupt != CurrentInterrupt) { dprintf2(("Changing interrupt to %u", CurrentInterrupt)); } *Interrupt = CurrentInterrupt; return Status; } if (Status != STATUS_DEVICE_CONFIGURATION_ERROR) { return Status; } } dprintf2(("No valid Interrupt found")); SoundSetErrorCode(pGDI->RegistryPathName, SOUND_CONFIG_NOINT); return STATUS_DEVICE_CONFIGURATION_ERROR; }
NTSTATUS SoundInitIoPort( IN OUT PGLOBAL_DEVICE_INFO pGDI, IN OUT PULONG Port ) { ULONG CurrentPort; int i; NTSTATUS Status; static CONST ULONG PortChoices[] = VALID_IO_PORTS; // // Make sure the one given really is in the list // if (!InList(PortChoices, *Port)) { return STATUS_DEVICE_CONFIGURATION_ERROR; } // // First check the port we were given. If this is not OK look // through them all in turn. 0xFFFF is an end marker in the array // for (i = 0, CurrentPort = *Port; CurrentPort != 0xFFFF; CurrentPort = PortChoices[i], i++) { Status = SoundPortValid(pGDI, &CurrentPort); if (NT_SUCCESS(Status)) { if (*Port != CurrentPort) { dprintf2(("Changing port number to %4X", CurrentPort)); } *Port = CurrentPort; return Status; } if (Status != STATUS_DEVICE_CONFIGURATION_ERROR) { return Status; } } dprintf2(("No valid IO port found")); SoundSetErrorCode(pGDI->RegistryPathName, SOUND_CONFIG_NOCARD); return STATUS_DEVICE_CONFIGURATION_ERROR; }
URL_DataDescriptor::~URL_DataDescriptor() { #ifdef DEBUG_LOAD_STATUS g_main_message_handler->UnsetCallBacks(this); #endif #ifdef _DEBUG_DD1 /* if(position != url.ContentLoaded() || url.Status(FALSE) == URL_LOADING) int stop = 1; */ #endif #ifdef _DEBUG_DD1 OpFileLength registered_len=0; url.GetAttribute(URL::KContentLoaded, ®istered_len); PrintfTofile("urldd1.txt","\nDD Destructor- %s - %s - %lu:%lu (%u:%u)\n", DebugGetURLstring(url), (url.GetAttribute(URL::KLoadStatus) == URL_LOADING ? "Not Loaded" : "Loaded"), (unsigned long) position, (unsigned long) registered_len, buffer_used, buffer_len ); #endif OP_DELETE(sub_desc); if(is_using_file && storage) storage->DecFileCount(); if(InList()) Out(); if(buffer) { if(url.GetAttribute(URL::KCachePolicy_NoStore)) OPERA_cleanse_heap(buffer, buffer_len); else op_memset(buffer, 0, buffer_len); OP_DELETEA(buffer); } g_charsetManager->DecrementCharsetIDReference(charset_id); g_charsetManager->DecrementCharsetIDReference(parent_charset); #ifdef DEBUG_LOAD_STATUS OP_ASSERT(dd_counter >0); dd_counter --; #endif #ifdef SELFTEST Context_Manager *mng=urlManager->FindContextManager(url.GetContextId()); if(mng) mng->RemoveDataDescriptorForStats(this); #endif // SELFTEST }
void Link::IntoStart(Head* list) { OP_ASSERT(!InList()); suc = list->first; if (suc) suc->pred = this; else list->last = this; list->first = this; parent = list; }
NTSTATUS SoundInitDmaChannel( IN OUT PGLOBAL_DEVICE_INFO pGDI, IN OUT PULONG DmaChannel, IN ULONG DmaBufferSize ) { ULONG CurrentDmaChannel; NTSTATUS Status; int i; static CONST ULONG DmaChannelChoices[] = VALID_DMA_CHANNELS; // // Make sure the one given really is in the list // if (!InList(DmaChannelChoices, *DmaChannel)) { return STATUS_DEVICE_CONFIGURATION_ERROR; } // // First check the channel we were given if this fails // try them all // for (i = 0, CurrentDmaChannel = *DmaChannel; CurrentDmaChannel != 0xFFFF; // 0xFFFF is terminator CurrentDmaChannel = DmaChannelChoices[i], i++) { Status = SoundDmaChannelValid(pGDI, &CurrentDmaChannel, DmaBufferSize); if (NT_SUCCESS(Status)) { if (*DmaChannel != CurrentDmaChannel) { dprintf2(("Changing DMA channel to %u", CurrentDmaChannel)); } *DmaChannel = CurrentDmaChannel; return Status; } if (Status != STATUS_DEVICE_CONFIGURATION_ERROR) { return Status; } } dprintf2(("No valid DMA channel found")); SoundSetErrorCode(pGDI->RegistryPathName, SOUND_CONFIG_NODMA); return STATUS_DEVICE_CONFIGURATION_ERROR; }
void Link::Into(Head* list) { OP_ASSERT(!InList()); pred = list->last; if (pred) pred->suc = this; else list->first = this; list->last = this; parent = list; }
DataStream::~DataStream() { #ifdef DATASTREAM_READ_RECORDS if(current_loading_record) { current_loading_record->FinishedAddingL(); // Abort loading; OP_DELETE(current_loading_record); } current_loading_record = NULL; // Deleted by owner #endif if(InList()) Out(); }
void Link::Follow(Link* l) { OP_ASSERT(!InList()); parent = l->parent; pred = l; suc = l->suc; if (suc) suc->pred = this; else parent->last = this; l->suc = this; }
void Link::Precede(Link* l) { OP_ASSERT(!InList()); parent = l->parent; suc = l; pred = l->pred; if (pred) pred->suc = this; else parent->first = this; l->pred = this; }
/*virtual*/ HEListElm::~HEListElm() { LoadInlineElm *lie = GetLoadInlineElm(); if (lie) { // GetLoadInlineElm() is NULL for disconnected HEListElms and for the print HEListElm list. if (InList()) { lie->Remove(this); if (lie->GetLoading() && lie->IsUnused() && !GetFramesDocument()->IsBeingFreed()) GetFramesDocument()->StopLoadingInline(lie); } } else Out(); Undisplay(); if (url_imagecontent_provider) url_imagecontent_provider->DecRef(this); }
void CleanupRedundantVotes::ProcessCall(CallStatement* c) { assert(c != NULL) ; SymbolAddressExpression* symAddress = dynamic_cast<SymbolAddressExpression*>(c->get_callee_address()) ; assert(symAddress != NULL) ; Symbol* sym = symAddress->get_addressed_symbol() ; assert(sym != NULL) ; if (sym->get_name() == LString("ROCCCTripleVote") || sym->get_name() == LString("ROCCCDoubleVote") ) { LoadVariableExpression* errorVariableExpression = dynamic_cast<LoadVariableExpression*>(c->get_argument(0)) ; assert(errorVariableExpression != NULL) ; VariableSymbol* currentError = errorVariableExpression->get_source() ; assert(currentError != NULL) ; if (InList(currentError)) { // Create a new variable VariableSymbol* errorDupe = create_variable_symbol(theEnv, currentError->get_type(), TempName(LString("UnrolledRedundantError"))) ; errorDupe->append_annote(create_brick_annote(theEnv, "DebugRegister")) ; procDef->get_symbol_table()->append_symbol_table_object(errorDupe) ; usedVariables.push_back(errorDupe) ; errorVariableExpression->set_source(errorDupe) ; } else { usedVariables.push_back(currentError) ; } } }
void TransformUnrolledArraysPass::TransformNDIntoNMinusOneD(int N) { // Get all unique N-dimensional arrays CollectArrays(N) ; // For every array access that has a constant as one of its offsets, // we have to create a new array list<VariableSymbol*> arraysToRemove ; list<EquivalentReferences*>::iterator refIter = currentReferences.begin() ; while (refIter != currentReferences.end()) { VariableSymbol* originalSymbol = GetArrayVariable((*refIter)->original) ; // Lookup tables should not be transformed if (originalSymbol->lookup_annote_by_name("LUT") == NULL) { bool replaced = ReplaceNDReference(*refIter) ; if (replaced) { if (!InList(arraysToRemove, originalSymbol)) { arraysToRemove.push_back(originalSymbol) ; } } } ++refIter ; } // Remove all of the arrays that need to be removed list<VariableSymbol*>::iterator arrayIter = arraysToRemove.begin() ; while (arrayIter != arraysToRemove.end()) { procDef->get_symbol_table()->remove_symbol_table_object(*arrayIter) ; ++arrayIter ; } }
virtual ~SuffixOverrideString(){if (InList()) Out();}
virtual ~SuffixString(){if (InList()) Out();}
// Do a sort of garbage collection. Take all of the types that we want to // delete and collect them. If there are no uses of them after this function // has finished, then remove them. void RemoveModulePass::RemoveProcedure(ProcedureSymbol* p) { assert(repository != NULL) ; list<Type*> usedTypes ; if (p == NULL) { return ; } // There should be no definition, but just in case remove it ProcedureDefinition* defToRemove = p->get_definition() ; p->set_definition(NULL) ; if (defToRemove != NULL) { delete defToRemove ; } // Clear out all of the values associated with the procedure type CProcedureType* procType = dynamic_cast<CProcedureType*>(p->get_type()) ; assert(procType != NULL) ; DataType* returnTypeToRemove = procType->get_result_type() ; procType->set_result_type(NULL) ; if (returnTypeToRemove != NULL) { usedTypes.push_back(returnTypeToRemove) ; } while (procType->get_argument_count() > 0) { QualifiedType* currentArg = procType->get_argument(0) ; procType->remove_argument(0) ; if (!InList(usedTypes, currentArg)) { usedTypes.push_back(currentArg) ; } } SymbolTable* symTab = repository->get_external_symbol_table() ; p->set_type(NULL) ; symTab->remove_symbol_table_object(procType) ; delete procType ; symTab->remove_symbol_table_object(p) ; delete p ; // Now, go through each used type and see if it is used anywhere list<Type*>::iterator typeIter = usedTypes.begin() ; while (typeIter != usedTypes.end()) { bool removeMe = true ; for (int i = 0 ; i < symTab->get_symbol_table_object_count() ; ++i) { CProcedureType* currentType = dynamic_cast<CProcedureType*>(symTab->get_symbol_table_object(i)) ; if (currentType != NULL) { if (IsUsed(*typeIter, currentType)) { removeMe = false ; break ; } } } if (removeMe) { if ((*typeIter)->lookup_annote_by_name("Output") != NULL) { delete (*typeIter)->remove_annote_by_name("Output") ; } QualifiedType* q = dynamic_cast<QualifiedType*>(*typeIter) ; DataType* d = dynamic_cast<DataType*>(*typeIter) ; if (q != NULL) { DataType* internalD = q->get_base_type() ; q->set_base_type(NULL) ; symTab->remove_symbol_table_object(internalD) ; symTab->remove_symbol_table_object(q) ; delete internalD ; delete q ; } else if (d != NULL) { symTab->remove_symbol_table_object(d) ; delete d ; } else { assert(0 && "Trying to remove something weird...") ; } } ++typeIter ; } }
printf("cas longueur=len(chaine):%s:\n",ptr); free(ptr); ptr=PadR("Herve","3","IX","\0"); printf("cas longueur<len(chaine):%s:\n",ptr); free(ptr); ptr=Delete("LIGNE DE DE TEXTE","DE ","\0"); printf("Delete:%s:\n",ptr); free(ptr); ptr=Delete("LIGNE DE DE TEXTE","de2 ","\0"); printf(":%s:\n",ptr); free(ptr); ptr=InList("TROIS","UN\nDEUX\nTROIS\nQUATRE\n","\0"); printf("InList:%s:\n",ptr); free(ptr); ptr=InList("TROIs","UN\nDEUX\nTROIS\nQUATRE\n","\0"); printf(":%s:\n",ptr); free(ptr); ptr=ReplaceAll("chmod a+x %fichier%\n%fichier%\nrm %fichier%\ncat %fichier% |more","%fichier%","MONSCRIPTE","\0"); printf("ReplaceAll:%s:\n",ptr); free(ptr); ptr=ReplaceAll("AAAAAAAAA","B","/","\0"); printf(":%s:\n",ptr); free(ptr);
Signer_Item::~Signer_Item() { password.Wipe(); if(InList()) Out(); }