Changeset 4613


Ignore:
Timestamp:
Mar 15, 2010 2:14:49 PM (5 years ago)
Author:
tboeckel
Message:
  • misc: replaced lots of NewList() calls by NewMinList() to get rid of the type casts. Additionally all lists are iternated using the IterateList() macro.
Location:
trunk
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r4612 r4613  
    1010  * misc: some changes to make the code compilable for non-OS4 systems. 
    1111  * Debug.c: added FLUSH() function to flush pending file output. 
     12  * misc: replaced lots of NewList() calls by NewMinList() to get rid of the 
     13    type casts. Additionally all lists are iternated using the IterateList() 
     14    macro. 
    1215 
    13162010-03-15 Jens Langner <Jens.Langner@light-speed.de> 
  • trunk/src/FolderList.c

    r4469 r4613  
    4242  ENTER(); 
    4343 
    44   NewList((struct List *)&flist->list); 
     44  NewMinList(&flist->list); 
    4545  flist->count = 0; 
    4646 
  • trunk/src/MailList.c

    r4469 r4613  
    4242  ENTER(); 
    4343 
    44   NewList((struct List *)&mlist->list); 
     44  NewMinList(&mlist->list); 
    4545  mlist->count = 0; 
    4646 
     
    365365 
    366366    // put all the sorted nodes back into the original list 
    367     NewList((struct List *)&mlist->list); 
     367    NewMinList(&mlist->list); 
    368368    while((node = RemHead(to)) != NULL) 
    369369      AddTail((struct List *)&mlist->list, node); 
  • trunk/src/MailServers.c

    r4611 r4613  
    5656  ENTER(); 
    5757 
    58   if((msn = (struct MailServerNode *)calloc(1, sizeof(msn))) != NULL) 
     58  if((msn = (struct MailServerNode *)calloc(1, sizeof(*msn))) != NULL) 
    5959  { 
    6060    msn->type = type; 
     
    108108    struct Node *curNode; 
    109109 
    110     // we have to free the mimeTypeList 
     110    // we have to free the mailServerList 
    111111    while((curNode = RemHead((struct List *)mailServerList)) != NULL) 
    112112    { 
    113113      struct MailServerNode *msn = (struct MailServerNode *)curNode; 
     114 
     115      D(DBF_ALWAYS, "freeing server '%s'", msn->account); 
     116      FLUSH(); 
    114117 
    115118      free(msn); 
     
    201204  ENTER(); 
    202205 
     206  D(DBF_ALWAYS, "find mailserver %ld", num); 
    203207  if(IsMinListEmpty(mailServerList) == FALSE) 
    204208  { 
     
    206210    struct Node *curNode; 
    207211 
    208     for(curNode = GetHead((struct List *)mailServerList); curNode != NULL; curNode = GetSucc(curNode)) 
     212    IterateList(mailServerList, curNode) 
    209213    { 
    210214      struct MailServerNode *msn = (struct MailServerNode *)curNode; 
     
    215219        { 
    216220          result = msn; 
     221          D(DBF_ALWAYS, "found mailserver %ld '%s'", num, result->account); 
    217222          break; 
    218223        } 
  • trunk/src/MailServers.h

    r4610 r4613  
    8989struct MailServerNode 
    9090{ 
    91   struct MinNode node;                  // required for placing it into struct Config 
     91  struct MinNode node;                   // required for placing it into struct Config 
    9292 
    93   enum MailServerType type;             // which type is this server? POP3 or SMTP? 
     93  enum MailServerType type;              // which type is this server? POP3 or SMTP? 
    9494 
    95   char account[SIZE_USERID+SIZE_HOST]; // user definable account name 
    96   char hostname[SIZE_HOST];             // servername/IP 
    97   char domain[SIZE_HOST];               // [SMTP] : the mail domain 
    98   int  port;                            // the port 
    99   char username[SIZE_USERID];           // the account ID/name 
    100   char password[SIZE_USERID];           // the password for this account 
     95  char account[SIZE_USERID+SIZE_HOST+1]; // user definable account name 
     96  char hostname[SIZE_HOST];              // servername/IP 
     97  char domain[SIZE_HOST];                // [SMTP] : the mail domain 
     98  int  port;                             // the port 
     99  char username[SIZE_USERID];            // the account ID/name 
     100  char password[SIZE_USERID];            // the password for this account 
    101101 
    102   unsigned int flags;                   // for mail server flags (MSF_#?) 
     102  unsigned int flags;                    // for mail server flags (MSF_#?) 
    103103}; 
    104104 
  • trunk/src/MimeTypes.c

    r4554 r4613  
    122122  if(IsMinListEmpty(mimeTypeList) == FALSE) 
    123123  { 
    124     struct MinNode *curNode; 
     124    struct Node *curNode; 
    125125 
    126126    // we have to free the mimeTypeList 
    127     while((curNode = (struct MinNode *)RemHead((struct List *)mimeTypeList)) != NULL) 
     127    while((curNode = RemHead((struct List *)mimeTypeList)) != NULL) 
    128128    { 
    129129      struct MimeTypeNode *mt = (struct MimeTypeNode *)curNode; 
     
    132132    } 
    133133 
    134     NewList((struct List *)mimeTypeList); 
     134    NewMinList(mimeTypeList); 
    135135  } 
    136136 
  • trunk/src/ReceiveMails.c

    r4611 r4613  
    455455    success = TRUE; 
    456456 
    457     NewList((struct List *)&tfn->mailTransferList); 
     457    NewMinList(&tfn->mailTransferList); 
    458458 
    459459    // get the first line the pop server returns after the LINE command 
     
    13031303      saveUIDL = TRUE; 
    13041304 
    1305       for(curNode = C->mailServerList.mlh_Head; curNode->mln_Succ; curNode = curNode->mln_Succ) 
     1305      IterateList(&C->mailServerList, curNode) 
    13061306      { 
    13071307        struct MailServerNode *msn = (struct MailServerNode *)curNode; 
     
    25692569    struct MinNode *curNode; 
    25702570 
    2571     for(curNode = C->mailServerList.mlh_Head; curNode->mln_Succ; curNode = curNode->mln_Succ) 
     2571    IterateList(&C->mailServerList, curNode) 
    25722572    { 
    25732573      msn = (struct MailServerNode *)curNode; 
  • trunk/src/Rexx.c

    r4599 r4613  
    382382    strlcpy(host->portname, basename, sizeof(host->portname)); 
    383383 
    384     if((host->port = usrport) != NULL) 
    385     { 
     384    if(usrport != NULL) 
     385    { 
     386      host->port = usrport; 
    386387      SET_FLAG(host->flags, ARB_HF_USRMSGPORT); 
    387388    } 
    388     else if((host->port = AllocSysObjectTags(ASOT_PORT, TAG_DONE)) != NULL) 
    389     { 
    390       host->port->mp_Node.ln_Pri = 0; 
     389    else 
     390    { 
     391      host->port = AllocSysObjectTags(ASOT_PORT, TAG_DONE); 
    391392    } 
    392393 
     
    557558  ENTER(); 
    558559 
    559   NewList((struct List *)stemList); 
     560  NewMinList(stemList); 
    560561 
    561562  // create an upper case copy of the STEM name 
  • trunk/src/SendMails.c

    r4611 r4613  
    11091109 
    11101110    // reset our processing list 
    1111     NewList((struct List *)&tfn->mailTransferList); 
     1111    NewMinList(&tfn->mailTransferList); 
    11121112 
    11131113    // temporarly copy all data out of our mlist to the 
  • trunk/src/Threads.c

    r4598 r4613  
    158158  ENTER(); 
    159159 
    160   NewList((struct List *)&thread->timer_request_list); 
     160  NewMinList(&thread->timer_request_list); 
    161161 
    162162  if((thread->timer_port = AllocSysObjectTags(ASOT_PORT, TAG_DONE)) != NULL) 
     
    315315    D(DBF_THREAD, "Subthreaded created port at 0x%08lx", thread->thread_port); 
    316316 
    317     NewList((struct List *)&thread->push_list); 
     317    NewMinList(&thread->push_list); 
    318318 
    319319    if(InitThreadTimer(thread) == TRUE) 
     
    440440            Forbid(); 
    441441 
    442             IterateList(G->mainThread.thread_port, node) 
     442            IterateList(&G->mainThread.thread_port->mp_MsgList, node) 
    443443            { 
    444444              struct ThreadMessage *tmsg = (struct ThreadMessage*)node; 
     
    940940 
    941941    // prepare the threads' function push list 
    942     NewList((struct List *)&G->mainThread.push_list); 
     942    NewMinList(&G->mainThread.push_list); 
    943943 
    944944    // initialize the subThread list 
    945     NewList((struct List *)&G->subThreadList); 
     945    NewMinList(&G->subThreadList); 
    946946 
    947947    // set the user data of the main thread 
  • trunk/src/Transfer.c

    r4611 r4613  
    9595  ENTER(); 
    9696 
    97   if((tfn = (struct TransferNode *)calloc(1, sizeof(struct TransferNode))) != NULL) 
     97  if((tfn = (struct TransferNode *)calloc(1, sizeof(*tfn))) != NULL) 
    9898  { 
    9999    // clear the mail list per default 
    100     NewList((struct List *)&tfn->mailTransferList); 
     100    NewMinList(&tfn->mailTransferList); 
    101101 
    102102    // set the socket to not being connected. 
     
    152152          // we walk through the TransferQueue and process each scheduled 
    153153          // mail transfer 
    154           for(curNode = GetHead((struct List *)&G->transferQueue); curNode != NULL; curNode = GetSucc(curNode)) 
     154          IterateList(&G->transferQueue, curNode) 
    155155          { 
    156156            struct TransferNode *tfn = (struct TransferNode *)curNode; 
     
    10801080  } 
    10811081 
    1082   NewList((struct List *)&tfn->mailTransferList); 
     1082  NewMinList(&tfn->mailTransferList); 
    10831083 
    10841084  LEAVE(); 
  • trunk/src/YAM.c

    r4610 r4613  
    25152515 
    25162516    // prepare the exec lists in G and C 
    2517     NewList((struct List *)&(C->mailServerList)); 
    2518     NewList((struct List *)&(C->mimeTypeList)); 
    2519     NewList((struct List *)&(C->filterList)); 
    2520     NewList((struct List *)&(G->readMailDataList)); 
    2521     NewList((struct List *)&(G->writeMailDataList)); 
    2522     NewList((struct List *)&(G->xpkPackerList)); 
    2523     NewList((struct List *)&(G->zombieFileList)); 
    2524     NewList((struct List *)&(G->transferQueue)); 
     2517    NewMinList(&C->mailServerList); 
     2518    NewMinList(&C->mimeTypeList); 
     2519    NewMinList(&C->filterList); 
     2520    NewMinList(&G->readMailDataList); 
     2521    NewMinList(&G->writeMailDataList); 
     2522    NewMinList(&G->xpkPackerList); 
     2523    NewMinList(&G->zombieFileList); 
     2524    NewMinList(&G->transferQueue); 
    25252525 
    25262526    // get the PROGDIR: and program name and put it into own variables 
  • trunk/src/YAM_CO.c

    r4611 r4613  
    739739 
    740740  // init the embedded lists in our config structure 
    741   NewList((struct List *)&co->mailServerList); 
    742   NewList((struct List *)&co->filterList); 
    743   NewList((struct List *)&co->mimeTypeList); 
     741  NewMinList(&co->mailServerList); 
     742  NewMinList(&co->filterList); 
     743  NewMinList(&co->mimeTypeList); 
    744744 
    745745  LEAVE(); 
     
    10941094 
    10951095  // then we have to do a deep copy and allocate separate memory for our copy 
    1096   NewList((struct List *)&dco->mailServerList); 
     1096  NewMinList(&dco->mailServerList); 
    10971097 
    10981098  if(success == TRUE) 
    10991099  { 
    1100     struct MinNode *curNode; 
    1101  
    1102     for(curNode = sco->mailServerList.mlh_Head; curNode->mln_Succ; curNode = curNode->mln_Succ) 
     1100    struct Node *curNode; 
     1101 
     1102    IterateList(&sco->mailServerList, curNode) 
    11031103    { 
    11041104      struct MailServerNode *srcNode = (struct MailServerNode *)curNode; 
     
    11181118 
    11191119  // for copying the mimetype list we have to do a deep copy of the list 
    1120   NewList((struct List *)&dco->mimeTypeList); 
     1120  NewMinList(&dco->mimeTypeList); 
    11211121 
    11221122  if(success == TRUE) 
     
    11411141 
    11421142  // for copying the filters we do have to do another deep copy 
    1143   NewList((struct List *)&dco->filterList); 
     1143  NewMinList(&dco->filterList); 
    11441144 
    11451145  if(success == TRUE) 
     
    14641464    // now we walk through our mailserver list and check and fix certains 
    14651465    // things in it 
    1466     for(curNode = GetHead((struct List *)&co->mailServerList); curNode != NULL; curNode = GetSucc(curNode)) 
     1466    IterateList(&co->mailServerList, curNode) 
    14671467    { 
    14681468      struct MailServerNode *msn = (struct MailServerNode *)curNode; 
  • trunk/src/YAM_COg.c

    r4610 r4613  
    13451345  ENTER(); 
    13461346 
    1347   if((msn = CreateNewMailServer(MST_POP3, CE, IsListEmpty((struct List *)&CE->mailServerList))) != NULL) 
    1348   { 
    1349     if(IsListEmpty((struct List *)&CE->mailServerList) == FALSE) 
     1347  if((msn = CreateNewMailServer(MST_POP3, CE, IsMinListEmpty(&CE->mailServerList))) != NULL) 
     1348  { 
     1349    if(IsMinListEmpty(&CE->mailServerList) == FALSE) 
    13501350      strlcpy(msn->account, tr(MSG_NewEntry), sizeof(msn->account)); 
    13511351 
  • trunk/src/YAM_COs.c

    r4610 r4613  
    925925          else if(stricmp(buf, "SMTP-AUTH-Pass") == 0)    strlcpy(fSMTP->password, Decrypt(value), sizeof(fSMTP->password)); 
    926926          else if(stricmp(buf, "SMTP-AUTH-Method") == 0)  SET_FLAG(fSMTP->flags, SMTPAuthMethod2MSF(atoi(value))); 
    927           else if(strnicmp(buf,"SMTP", 4) == 0 && isdigit(buf[4]) && isdigit(buf[5]) && strchr(buf, '.')) 
     927          else if(strnicmp(buf,"SMTP", 4) == 0 && isdigit(buf[4]) && isdigit(buf[5]) && strchr(buf, '.') != NULL) 
    928928          { 
    929929            int id = atoi(&buf[4]); 
     
    966966              W(DBF_CONFIG, "SMTP id < 0 : %ld", id); 
    967967          } 
    968           else if(strnicmp(buf,"POP", 3) == 0 && isdigit(buf[3]) && isdigit(buf[4]) && strchr(buf, '.')) 
     968          else if(strnicmp(buf,"POP", 3) == 0 && isdigit(buf[3]) && isdigit(buf[4]) && strchr(buf, '.') != NULL) 
    969969          { 
    970970            int id = atoi(&buf[3]); 
     
    23912391    { 
    23922392      int numPops = 0; 
    2393       struct MinNode *curNode; 
     2393      struct Node *curNode; 
    23942394      struct MailServerNode *msn; 
    23952395 
     
    24202420      // we iterate through our mail server list and make sure to populate 
    24212421      // out NList object correctly. 
    2422       for(numPops=0, curNode = CE->mailServerList.mlh_Head; curNode->mln_Succ; curNode = curNode->mln_Succ) 
     2422      numPops = 0; 
     2423      IterateList(&C->mailServerList, curNode) 
    24232424      { 
    24242425        struct MailServerNode *msn = (struct MailServerNode *)curNode; 
  • trunk/src/YAM_FI.c

    r4609 r4613  
    529529  search->Pattern = search->PatBuf; 
    530530  search->Fast = FS_NONE; 
    531   NewList((struct List *)&search->patternList); 
     531  NewMinList(&search->patternList); 
    532532 
    533533  switch(mode) 
     
    18441844 
    18451845  // then iterate through our ruleList and copy it as well 
    1846   NewList((struct List *)&dstFilter->ruleList); 
     1846  NewMinList(&dstFilter->ruleList); 
    18471847 
    18481848  IterateList(&srcFilter->ruleList, curNode) 
     
    19111911 
    19121912  // now we have to copy the patternList as well 
    1913   NewList((struct List *)&dstSearch->patternList); 
     1913  NewMinList(&dstSearch->patternList); 
    19141914  IterateList(&srcSearch->patternList, curNode) 
    19151915  { 
     
    19521952 
    19531953  // initialize the ruleList as well 
    1954   NewList((struct List *)&filter->ruleList); 
     1954  NewMinList(&filter->ruleList); 
    19551955 
    19561956  LEAVE(); 
     
    20952095 
    20962096    // initialize the rule list 
    2097     NewList((struct List *)&filter->ruleList); 
     2097    NewMinList(&filter->ruleList); 
    20982098 
    20992099    // and fill in the first rule as a filter can't have less than 1 rule 
     
    21442144  } 
    21452145 
    2146   NewList((struct List *)filterList); 
     2146  NewMinList(filterList); 
    21472147 
    21482148  LEAVE(); 
  • trunk/src/YAM_MA.c

    r4610 r4613  
    24662466 
    24672467  // Don't proceed if another transfer is in progress 
    2468   if(G->activeTransfer == FALSE) 
     2468  if(G->activeTransfer == NULL) 
    24692469  { 
    24702470    struct MailServerNode *msn; 
     
    25182518  // we only proceed if there isn't already a transfer 
    25192519  // window/process in action 
    2520   if(G->activeTransfer == FALSE) 
     2520  if(G->activeTransfer == NULL) 
    25212521  { 
    25222522    struct MailList *mlist = NULL; 
     
    31213121      // contains. 
    31223122      if(TR_GetMessageList_IMPORT() == TRUE) 
    3123       {  
     3123      { 
    31243124        if(quiet == TRUE || SafeOpenWindow(G->transferWindowObject) == TRUE) 
    31253125          result = TRUE; 
     
    38843884  End; 
    38853885 
    3886   if(G->MA->GUI.MI_CSINGLE !=  NULL) 
     3886  if(G->MA->GUI.MI_CSINGLE != NULL) 
    38873887  { 
    38883888    int i; 
    3889     struct MinNode *curNode; 
     3889    struct Node *curNode; 
    38903890 
    38913891    // we iterate through our mail server list and ouput the POP3 servers in it 
    3892     for(i=0, curNode = C->mailServerList.mlh_Head; curNode->mln_Succ; curNode = curNode->mln_Succ) 
     3892    i = 0; 
     3893    IterateList(&C->mailServerList, curNode) 
    38933894    { 
    38943895      struct MailServerNode *msn = (struct MailServerNode *)curNode; 
     
    44064407    { 
    44074408      ULONG i; 
    4408       struct MinNode *curNode; 
     4409      struct Node *curNode; 
    44094410 
    44104411      DoMethod(data->GUI.NL_FOLDERS, MUIM_MainFolderListtree_MakeFormat); 
     
    44954496 
    44964497      // we iterate through our mail server list and ouput the POP3 servers in it 
    4497       for(i=0, curNode = C->mailServerList.mlh_Head; curNode->mln_Succ; curNode = curNode->mln_Succ) 
     4498      i = 0; 
     4499      IterateList(&C->mailServerList, curNode) 
    44984500      { 
    44994501        struct MailServerNode *msn = (struct MailServerNode *)curNode; 
  • trunk/src/YAM_MAf.c

    r4602 r4613  
    15521552 
    15531553    // clear the headerList first 
    1554     NewList((struct List *)headerList); 
     1554    NewMinList(headerList); 
    15551555 
    15561556    // we read out the whole header line by line and 
  • trunk/src/YAM_RE.c

    r4610 r4613  
    36863686              // immediately we go and send it out in case everything is 
    36873687              // prepared and there is no other active Transfer 
    3688               if(sendnow == TRUE && mlist->count != 0 && G->activeTransfer == FALSE) 
     3688              if(sendnow == TRUE && mlist->count != 0 && G->activeTransfer == NULL) 
    36893689                SendMails(mlist, autoSend ? SEND_ACTIVE_AUTO : SEND_ACTIVE_USER); 
    36903690 
  • trunk/src/mui/ReadMailGroup.c

    r4585 r4613  
    606606 
    607607      // prepare the senderInfoHeader list 
    608       NewList((struct List *)&data->senderInfoHeaders); 
     608      NewMinList(&data->senderInfoHeaders); 
    609609 
    610610      // place our data in the node and add it to the readMailDataList 
    611611      rmData->readMailGroup = obj; 
    612       AddTail((struct List *)&(G->readMailDataList), (struct Node *)data->readMailData); 
     612      AddTail((struct List *)&G->readMailDataList, (struct Node *)data->readMailData); 
    613613 
    614614      // now we connect some notifies. 
Note: See TracChangeset for help on using the changeset viewer.