void asCScriptObject::Destruct() { // Call the destructor, which will also call the GCObject's destructor this->~asCScriptObject(); // Free the memory userFree(this); }
void serverFree(LUser* luser){ int i; User *usr; for(i = 0;i<luser->numUser;i++){ usr = luser->listU[i]; userFree(usr); } free(luser); }
static void uboxFree(Ubox* box) { User *next, *u; for(u = box->head; u != nil; u = next){ next = u->next; userFree(u); } vtMemFree(box); }
int removeUser(LUser *luser,char* nick){ int i; int found = 0; User *usr; if(DEBUG_MODE) printf("removeUser -> buscando usuario y moviendo listas\n"); for(i = 0;i < luser->numUser;i++){ if(found == 0){ if(strcmp(nick,luser->listU[i]->nick) == 0){ found = 1; usr = luser->listU[i]; luser->listU[i] = luser->listU[i+1]; } } else{ luser->listU[i] = luser->listU[i+1]; } } if(found == 1){ if(DEBUG_MODE) printf("removeUser -> usuario encontrado\n"); int i; User *friend; if(DEBUG_MODE) printf("removeUser -> borrandose de amigos\n"); for(i = 0;i<MAXUSER;i++){ friend = luser->listU[i]; if(friend != NULL){ if(DEBUG_MODE) printf("removeUser ->%s le borra de amigos\n",friend->nick); removeFriend(friend,nick); if(DEBUG_MODE) printf("removeUser ->%s le borra de pendientes\n",friend->nick); removeFriendRequestPending(friend,nick); if(DEBUG_MODE) printf("removeUser ->%s le borra de enviados\n",friend->nick); removeFriendRequestSend(friend,nick); } } if(DEBUG_MODE) printf("removeUser -> liberando usuario\n"); userFree(usr); char *path = (char*)malloc(256*sizeof(char)); if(DEBUG_MODE) printf("removeUser -> eliminando directorios\n"); sprintf(path,"rm -R %s%s",DATA_PATH,nick); system(path); free(path); } luser->numUser--; return 0; }
void asCScriptObject::Destruct() { // Call the destructor, which will also call the GCObject's destructor this->~asCScriptObject(); // Free the memory #ifndef WIP_16BYTE_ALIGN userFree(this); #else // Script object memory is allocated through asCScriptEngine::CallAlloc() // This free call must match the allocator used in CallAlloc(). userFreeAligned(this); #endif }
int main() { int i; srand(time(NULL)); watch_me_t * watchMe = serviseNew("WatchMeNow.com"); servicePrintSerials(watchMe); // user_t * user[3]; user[0]=userNew("Dima",1); userAddSerial(user[0],"Game of Thrones"); user[1]=userNew("Tom",2); userAddSerial(user[1],"Game of Thrones"); userAddSerial(user[1],"Walking Dead"); user[2]=userNew("Vlad",3); userAddSerial(user[2],"Walking Dead"); userAddSerial(user[2],"Session approaching"); userAddSerial(user[2],"Hi army!"); //puts(getUserSerial(user[0],0)); puts(""); puts("Users:"); userPrint(user[0]); userPrint(user[1]); userPrint(user[2]); for ( i = 0; i < 3; i++) { serviceSubscribeNotification(watchMe, user[i], userNotification); } for( i = 1;i<32;i++){ serviceScheduleForToday(watchMe,i,"New series coming out today!"); } serviseDelete(watchMe); for(i=0;i<3;i++){ userFree(user[i]); } test(); }
void alignedFree(void *mem) { userFree( ((void**)mem)[-1] ); }