TransportRequest::~TransportRequest() { // Delete the TransportRequest object. // Returns: Nothing. #if defined(DEBUG) dlog->log_entry(DEBUG_MINTRC, "TransportRequest::~TransportRequest()"); #endif if(m) { xadelete(modarg, Argument); xadelete(rmodarg, Argument); xdelete(h); } modarg = NULL; rmodarg = NULL; h = NULL; xdelete(mod); xdelete(modt); t = 0; #if defined(DEBUG) dlog->log_exit(DEBUG_MINTRC, "TransportRequest::~TransportRequest()"); #endif }
XMLNode::~XMLNode() { // Deallocate the XMLNode. This will also deallocate any children // of this node. // Returns: Nothing. #if defined(DEBUG) dlog->log_entry(DEBUG_MINTRC, "XMLNode::~XMLNode()"); #endif // This will recursively delete all the nodes stored within the Array. xadelete(cs, XMLNode); xdelete(n); xdelete(d); xdelete(ans); xdelete(avs); // Don't delete this, just reset it. p = NULL; #if defined(DEBUG) dlog->log_exit(DEBUG_MINTRC, "XMLNode::~XMLNode()"); #endif }
StringArg::~StringArg() { // Deallocate the StringArg object. // Return: Nothing. xdelete(v); xdelete(vs); }
RelationArg::~RelationArg() { // Deallocate the RelationArg object. // Return: Nothing. rel = eq_rel; xdelete(xval); xdelete(yval); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \brief 소멸자 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CAsyncPeerListener::~CAsyncPeerListener() { SafeGuard(); // 리슨 소켓 닫고 if (m_ListenSock != INVALID_SOCKET) { closesocket(m_ListenSock); m_ListenSock = INVALID_SOCKET; } // 할당된 모든 피어들 강제 Disconnect for (auto itr(m_PeerArray.begin()); itr != m_PeerArray.end(); ++itr) { CAsyncTcpPeer* peer = *itr; peer->PostDisconnect(CAsyncTcpEvent::DR_FORCE); } // 모든 피어 정리 for (int delCount = 0; delCount < m_AllocCount;) { CAsyncTcpPeer* peer = nullptr; while (m_Queue.try_pop(peer)) { if (peer) { xdelete(peer); ++delCount; } } } }
bool List::sort(sort_t order) { // Sort the contents of the list according to <order>. // Returns: True if fully successful, false otherwise. bool ret = false; #if defined(DEBUG) dlog->log_entry(DEBUG_MINTRC, "List::sort(%d)", order); #endif qs_sort(0, size-1, order); // Regenerate commaline xdelete(commaline); for(int i = 0;i < size;i++) { if(i > 0) commaline = xstrcat(commaline, ","); commaline = xstrcat(commaline, items[i]); } ret = true; #if defined(DEBUG) dlog->log_exit(DEBUG_MINTRC, "List::sort = %s", IOTF(ret)); #endif return(ret); }
SessionManager::~SessionManager() { for (auto it : mFreeSessionList) { xdelete(it); } }
int main() { char str[16]; int i, age=10, ret=0; while (i=getchar()) { if (i=='q') break; if (i=='p') { printf("input name: \n"); scanf("%s",str); xpush(str, age++); } else if (i=='f') { printf("search name : \n"); scanf("%s", str); ret = xfind(str); printf("ret : %d \n", ret); } else if (i=='d') { printf("xdelete name : \n"); scanf("%s", str); xdelete(str); } } xfree(); return 0; }
FileDebugger::~FileDebugger() { // Deallocate the FileDebugger object. // Returns: Nothing. xdelete(f); }
Inhibition::~Inhibition() { // Deallocate the Inhibition object. // Returns: Nothing. #if defined(DEBUG) dlog->log_entry(DEBUG_MINTRC, "Inhibition::~Inhibition()"); #endif xdelete(w); xdelete(y); #if defined(DEBUG) dlog->log_exit(DEBUG_MINTRC, "Inhibition::~Inhibition()"); #endif }
FlagArg::~FlagArg() { // Deallocate the FlagArg object. // Return: Nothing. xdelete(v); }
void CHIKMTree::vl_hikm_free_VlHIKMTree() { if (m_VlHIKMTree) { if (m_VlHIKMTree->root) xdelete (m_VlHIKMTree -> root) ; free (m_VlHIKMTree) ; m_VlHIKMTree = NULL; } }
ModuleConfigError::~ModuleConfigError() { // Deallocate the ModuleConfigError object. // Returns: Nothing. #if defined(DEBUG) dlog->log_exit(DEBUG_MINTRC, "ModuleConfigError::~ModuleConfigError()"); #endif xdelete(e); xdelete(n); xdelete(t); #if defined(DEBUG) dlog->log_exit(DEBUG_MINTRC, "ModuleConfigError::~ModuleConfigError()"); #endif }
VL_EXPORT void vl_hikm_delete (VlHIKMTree *f) { if (f) { xdelete (f -> root) ; vl_free (f) ; } }
HostClass::~HostClass() { // Deallocate the HostClass object. // Returns: Nothing. #if defined(DEBUG) dlog->log_entry(DEBUG_MINTRC, "HostClass::~HostClass()"); #endif alertplan = NULL; checksched = NULL; xdelete(classname); xdelete(hostlist); #if defined(DEBUG) dlog->log_exit(DEBUG_MINTRC, "HostClass::~HostClass()"); #endif }
Dependency::~Dependency() { // Deallocate the Dependency object. // Returns: Nothing. #if defined(DEBUG) dlog->log_entry(DEBUG_MINTRC, "Dependency::~Dependency()"); #endif d = NULL; dt = 0; xdelete(th); xdelete(shs); xdelete(sxhs); #if defined(DEBUG) dlog->log_exit(DEBUG_MINTRC, "Dependency::~Dependency()"); #endif }
SurvivorStatus::~SurvivorStatus() { // Deallocate the SurvivorStatus object. // Returns: Nothing. xadelete(merrs, ModuleConfigError); xadelete(scks, StalledCheck); xdelete(perr); atime = 0; ctime = 0; }
Session::~Session() { // Deallocate the Session object. // Returns: Nothing. #if defined(DEBUG) dlog->log_entry(DEBUG_MINTRC, "Session::~Session()"); #endif xdelete(g); xdelete(h); xdelete(s); xdelete(u); exp = 0; #if defined(DEBUG) dlog->log_exit(DEBUG_MINTRC, "Session::~Session()"); #endif }
void CHIKMTree::vl_hikm_init_VlHIKMTree(vl_uint32 M, vl_uint32 K, vl_uint32 depth) { if (!m_VlHIKMTree) { vl_hikm_new_VlHIKMTree(); } xdelete (m_VlHIKMTree -> root) ; m_VlHIKMTree -> root = NULL; m_VlHIKMTree -> M = M ; m_VlHIKMTree -> K = K ; m_VlHIKMTree -> depth = depth ; }
bool SurvivorStatus::add_stalled_check(char *service, char *host, time_t lastcheck) { // Add the stalled check <service>@<host> with last check time <lastcheck> // to the list of stalled checks. // Returns: true if fully successful, false otherwise. bool ret = false; #if defined(DEBUG) dlog->log_entry(DEBUG_MINTRC, "SurvivorStatus::add_stalled_check(%s,%s,%d)", IONULL(service), IONULL(host), lastcheck); #endif if(service && host && lastcheck) { if(!scks) { // Allocate the holding array if it doesn't exist yet scks = new Array<StalledCheck>(); } if(scks) { StalledCheck *sck = new StalledCheck(service, host, lastcheck); if(sck) { if(scks->add(sck)) ret = true; else { xdelete(sck); } } else wlog->warn("SurvivorStatus::add_stalled_check failed to allocate sck"); } else wlog->warn("SurvivorStatus::add_stalled_check failed to allocate Array"); } #if defined(DEBUG) dlog->log_exit(DEBUG_MINTRC, "SurvivorStatus::add_stalled_check = %s", IOTF(ret)); #endif return(ret); }
bool SurvivorStatus::add_module_error(char *modname, char *modtype, char *err) { // Add the error <err> for the module <modname> of type <modtype> to // the list of module errors. // Returns: true if fully successful, false otherwise. bool ret = false; #if defined(DEBUG) dlog->log_entry(DEBUG_MINTRC, "SurvivorStatus::add_module_error(%s,%s,%s)", IONULL(modname), IONULL(modtype), IONULL(err)); #endif if(modname && modtype && err) { if(!merrs) { // Allocate the holding array if it doesn't exist yet merrs = new Array<ModuleConfigError>(); } if(merrs) { ModuleConfigError *mce = new ModuleConfigError(modname, modtype, err); if(mce) { if(merrs->add(mce)) ret = true; else { xdelete(mce); } } else wlog->warn("SurvivorStatus::add_module_error failed to allocate MCE"); } else wlog->warn("SurvivorStatus::add_module_error failed to allocate Array"); } #if defined(DEBUG) dlog->log_exit(DEBUG_MINTRC, "SurvivorStatus::add_module_error = %s", IOTF(ret)); #endif return(ret); }
static void xdelete (VlHIKMNode *node) { if(node) { if (node->children) { for(vl_uint32 k = 0 ; k < node->filter->vl_ikm_get_k() ; k++) xdelete (node->children[k]) ; free (node->children) ; } if (node->filter) node->filter->vl_ikm_delete_tree(); //delete(node->filter); free(node); } }
List::~List() { // Deallocate the List object. // Returns: Nothing. #if defined(DEBUG) dlog->log_entry(DEBUG_MINTRC, "List::~List()"); #endif if(size && items) { #if defined(DEBUG) dlog->log_progress(DEBUG_MINMEM, "Freeing items"); #endif for(int i = 0;i < size;i++) if(items[i]) { delete items[i]; items[i] = NULL; } free(items); } items = NULL; size = 0; xdelete(commaline); xdelete(listname); #if defined(DEBUG) dlog->log_exit(DEBUG_MINTRC, "List::~List()"); #endif }
VL_EXPORT void vl_hikm_init (VlHIKMTree *f, int M, int K, int depth) { assert(depth > 0) ; assert(M > 0) ; assert(K > 0) ; xdelete (f -> root) ; f -> root = 0; f -> M = M ; f -> K = K ; f -> depth = depth ; }
static void xdelete (VlHIKMNode *node) { if(node) { int k ; if (node->children) { for(k = 0 ; k < vl_ikm_get_K (node->filter) ; ++k) xdelete (node->children[k]) ; vl_free (node->children) ; } if (node->filter) vl_ikm_delete (node->filter) ; vl_free(node); } }
FixStateData::~FixStateData() { // Deallocate the FixStateData object. // Returns: Nothing. #if defined(DEBUG) dlog->log_entry(DEBUG_MINTRC, "FixStateData::~FixStateData()"); #endif xdelete(by); #if defined(DEBUG) dlog->log_exit(DEBUG_MINTRC, "FixStateData::~FixStateData()"); #endif }
CGIAuthModule::~CGIAuthModule() { // Delete the CGIAuthModule object. // Returns: Nothing. #if defined(DEBUG) dlog->log_entry(DEBUG_MINTRC, "CGIAuthModule::~CGIAuthModule()"); #endif xdelete(mname); xadelete(mopts, Argument); #if defined(DEBUG) dlog->log_exit(DEBUG_MINTRC, "CGIAuthModule::~CGIAuthModule()"); #endif }
bool RunningState::note(char *scheduler) { // Update the running state file for the <scheduler> by updating the // last modified time of the file. // Returns: true if fully successful, false otherwise. bool r = false; #if defined(DEBUG) dlog->log_entry(DEBUG_MINTRC, "RunningState::note(%s)", IONULL(scheduler)); #endif if(scheduler) { char *sf = new char[strlen(args->statedir()) + strlen(scheduler) + 10]; if(sf) { sprintf(sf, "%s/running/%s", args->statedir(), scheduler); FILE *touch = try_fopen(sf, "w"); if(touch) { fclose(touch); r = true; } else wlog->warn("RunningState::note failed to touch '%s'", sf); xdelete(sf); } else wlog->warn("RunningState::note failed to allocate sf"); } #if defined(DEBUG) dlog->log_exit(DEBUG_MINTRC, "RunningState::note = %s", IOTF(r)); #endif return(r); }
CheckResult *check(int i) { CheckResult *rv = NULL; // List->retrieve is MT-Safe. cmargs is set before this is called. char *domain = cmargs->hosts()->retrieve(i); if(domain && module && moduletype) { rv = new CheckResult(MODEXEC_MISCONFIG, 0, ""); if(rv) { struct hostent h, *hp; struct sockaddr_in s; char hbuf[BUFSIZE]; int herr; #if defined(HAVE_FUNC_GETHOSTBYNAME_R_3) struct hostent_data data; int r = gethostbyname_r(domain, &h, &data); hp = &h; if(r == 0) #elif defined(HAVE_FUNC_GETHOSTBYNAME_R_5) hp = gethostbyname_r(domain, &h, hbuf, BUFSIZE, &herr); if(hp) #elif defined(HAVE_FUNC_GETHOSTBYNAME_R_6) int r = gethostbyname_r(domain, &h, hbuf, BUFSIZE, &hp, &herr); if(r == 0) #else #error Supported gethostbyname_r not found #endif { memset(&s, 0, sizeof(s)); s.sin_family = hp->h_addrtype; strncpy((char *)&s.sin_addr, hp->h_addr, hp->h_length); s.sin_port = port; int sd = socket(AF_INET, SOCK_STREAM, 0); if(sd >= 0) { if(connect(sd, (struct sockaddr *)&s, sizeof(s)) == 0) { // SRProtocol handles the communication SRProtocol *srp = new SRProtocol(sd); if(srp) { CheckResult *srpres = NULL; // Make the appropriate request if(strcmp(moduletype, "check")==0) { CheckRequest *cr = new CheckRequest("localhost", timeout, modargs, false); if(cr) { srpres = srp->check(module, cr); xdelete(cr); } else SET_CHECKRESULT(rv, MODEXEC_PROBLEM, 0, "Failed to allocate CheckRequest"); } else { FixRequest *fr = new FixRequest(modargs, "localhost", timeout); if(fr) { srpres = srp->fix(module, fr); xdelete(fr); } else SET_CHECKRESULT(rv, MODEXEC_PROBLEM, 0, "Failed to allocate FixRequest"); } // Store the answer if(srpres) { xdelete(rv); rv = srpres; } // Tell the other end we're done srp->exit(); xdelete(srp); } else SET_CHECKRESULT(rv, MODEXEC_PROBLEM, 0, "Failed to allocate SRProtocol"); } else SET_CHECKRESULT(rv, MODEXEC_PROBLEM, 0, "Connection refused"); close(sd); } else SET_CHECKRESULT(rv, MODEXEC_PROBLEM, 0, "Failed to obtain socket"); } else SET_CHECKRESULT(rv, MODEXEC_PROBLEM, 0, "Unknown host"); } } return(rv); }
bool TwoWayReply::parse(RFC822Message *msg) { // Parse the message in <msg>. Parsing continues until all data has // been read. If an item is specified multiple times, only the // first will be used. If parsing is not successful, the individual // Reply methods may be used to see what information was // successfully read. // Returns: true if all items were successfully parsed from the message, // false otherwise. bool ret = false; #if defined(DEBUG) dlog->log_entry(DEBUG_MAJTRC, "TwoWayReply::parse(%d)", msg); dlog->log_progress(DEBUG_PARSER, "Trying to parse message as Nextel reply"); #endif if(msg) { // First, get stuff from the headers char *mf = msg->header_entry("From", 0); if(mf) { #if defined(DEBUG) dlog->log_progress(DEBUG_PARSER, "Message from '%s'", mf); #endif f = xstrdup(mf); } char *ms = msg->header_entry("Subject", 0); if(ms) { // Pull out hostname and service char *p = strstr(ms, "ALERT: "); if(p) { p += 7; List *ts = tokenize(p, "@"); if(ts) { // This was backwards, bug #635 // Patched by Olivier Calle svc = xstrdup(ts->retrieve(0)); h = xstrdup(ts->retrieve(1)); #if defined(DEBUG) dlog->log_progress(DEBUG_PARSER, "Host '%s', service '%s'", h, svc); #endif xdelete(ts); } } } // Now get the rest of the info from the body CharBuffer *body = msg->body(); if(body) { for(char *s = body->read_line();s != NULL;s = body->read_line()) { if(!t && strncmp(s, "Token=", 6)==0) { // Pull out token t = xstrdup(s+6); #if defined(DEBUG) dlog->log_progress(DEBUG_PARSER, "Token '%s'", t); #endif } else if(!inst && strncmp(s, "Instance=", 9)==0) { // Pull out instance inst = xstrdup(s+9); #if defined(DEBUG) dlog->log_progress(DEBUG_PARSER, "Instance '%s'", inst); #endif } else if(ry == unknown_reply && strcmp(s, "Acknowledge")==0) { ry = acknowledge_reply; #if defined(DEBUG) dlog->log_progress(DEBUG_PARSER, "Reply command '%s'", s); #endif } else if(ry == unknown_reply && strcmp(s, "Escalate")==0) { ry = escalate_reply; #if defined(DEBUG) dlog->log_progress(DEBUG_PARSER, "Reply command '%s'", s); #endif } else if(ry == unknown_reply && strcmp(s, "Inhibit")==0) { ry = inhibit_reply; #if defined(DEBUG) dlog->log_progress(DEBUG_PARSER, "Reply command '%s'", s); #endif } } } if(f && h && inst && svc && t && (ry != unknown_reply)) ret = true; } #if defined(DEBUG) dlog->log_exit(DEBUG_MAJTRC, "TwoWayReply::parse = %s", IOTF(ret)); #endif return(ret); }