Changeset 15282
- Timestamp:
- 04/16/12 01:10:45 (11 years ago)
- Location:
- titan/titan
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/titan/ca.h
r15189 r15282 188 188 } 189 189 190 struct queue* qe = addqueue(dvbnode->devnr, tmpbuf, len, flag, NULL);190 struct queue* qe = addqueue(dvbnode->devnr, tmpbuf, len, NULL, 0, flag, NULL); 191 191 free(tmpbuf); tmpbuf = NULL; 192 192 if(qe == NULL) -
titan/titan/queue.h
r10718 r15282 13 13 } 14 14 15 struct queue* addqueue(int type, void* data, int len, int flag, struct queue* last)15 struct queue* addqueue(int type, void* data, int len, void* dat1, int len1, int flag, struct queue* last) 16 16 { 17 17 //debug(1000, "in"); … … 20 20 21 21 struct queue *newnode = NULL, *prev = NULL, *node = queue; 22 void* tmpdata = NULL ;22 void* tmpdata = NULL, *tmpdata1 = NULL; 23 23 24 24 newnode = (struct queue*)malloc(sizeof(struct queue)); … … 30 30 } 31 31 32 tmpdata = malloc(len); 33 if(tmpdata == NULL) 32 if(len > 0) 34 33 { 35 err("no memory"); 36 free(newnode); 37 m_unlock(&status.queuemutex, 11); 38 return NULL; 34 tmpdata = malloc(len); 35 if(tmpdata == NULL) 36 { 37 err("no memory"); 38 free(newnode); 39 m_unlock(&status.queuemutex, 11); 40 return NULL; 41 } 39 42 } 43 44 if(len1 > 0) 45 { 46 tmpdata1 = malloc(len1); 47 if(tmpdata1 == NULL) 48 { 49 err("no memory"); 50 free(tmpdata); 51 free(newnode); 52 m_unlock(&status.queuemutex, 11); 53 return NULL; 54 } 55 } 56 40 57 memset(newnode, 0, sizeof(struct queue)); 41 58 … … 43 60 newnode->len = len; 44 61 newnode->flag = flag; 45 newnode->data = memcpy(tmpdata, data, len); 62 if(len > 0) newnode->data = memcpy(tmpdata, data, len); 63 if(len1 > 0) newnode->data1 = memcpy(tmpdata1, data1, len1); 46 64 47 65 if(last == NULL) … … 101 119 free(node->data); 102 120 node->data = NULL; 121 122 free(node->data1); 123 node->data1 = NULL; 103 124 104 125 free(node); -
titan/titan/struct.h
r15281 r15282 198 198 int len; 199 199 void* data; 200 void* data1; 200 201 struct queue* prev; 201 202 struct queue* next;
Note: See TracChangeset
for help on using the changeset viewer.