comparison TaskManager/Fifo/MailManager.cc @ 6:39ce245235d4

*** empty log message ***
author gongo
date Wed, 06 Feb 2008 11:41:08 +0900
parents 75f184d16fa5
children 98bb1b2bb71e
comparison
equal deleted inserted replaced
5:75f184d16fa5 6:39ce245235d4
14 int 14 int
15 MailManager::extend_pool_mailQueue(int num) 15 MailManager::extend_pool_mailQueue(int num)
16 { 16 {
17 MailQueuePtr q; 17 MailQueuePtr q;
18 18
19 //q = new MailQueue[num+1];
20 q = (MailQueuePtr)malloc(sizeof(MailQueue)*(num+1)); 19 q = (MailQueuePtr)malloc(sizeof(MailQueue)*(num+1));
21 20
22 if (q == NULL) { 21 if (q == NULL) {
23 return -1; 22 return -1;
24 } 23 }
25 q->next = mailQueuePool; 24 q->next = mailQueuePool;
26 mailQueuePool = q; 25 mailQueuePool = q;
27 26
28 /* Connect all free queue in the pool */ 27 /* Connect all free queue in the pool */
29 q = mailQueuePool + 1; 28 for (q = mailQueuePool + 1; --num > 0; q++) {
30 for (q = mailQueuePool + 1; num-- > 0; q++) {
31 q->next = q + 1; 29 q->next = q + 1;
32 } 30 }
33 q->next = freeMailQueue; 31 q->next = freeMailQueue;
34 freeMailQueue = mailQueuePool + 1; 32 freeMailQueue = mailQueuePool + 1;
35 33