Changeset 3039 for trunk/module-obj-llist.c
- Timestamp:
- 09/12/10 01:38:07 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/module-obj-llist.c
r2151 r3039 34 34 o = llist_itr_remove(&itr); 35 35 } 36 pthread_mutex_destroy(&l->lock); 36 37 free(l); 37 38 // llist_itr_release(&itr); … … 60 61 } 61 62 l->last = ln; 63 64 l->items++; 65 } 66 pthread_mutex_unlock(&l->lock); 67 68 return o; 69 } 70 71 void *llist_insert_first(LLIST *l, void *o) 72 { 73 if (!l) 74 return NULL; 75 pthread_mutex_lock(&l->lock); 76 if (o) { 77 struct llist_node *ln = malloc(sizeof(struct llist_node)); 78 if (!ln) { 79 pthread_mutex_unlock(&l->lock); 80 return NULL; 81 } 82 83 memset(ln, 0, sizeof(struct llist_node)); 84 ln->obj = o; 85 86 if (l->first) { 87 ln->nxt = l->first; 88 ln->nxt->prv = ln; 89 } else { 90 l->last = ln; 91 } 92 l->first = ln; 62 93 63 94 l->items++;
Note:
See TracChangeset
for help on using the changeset viewer.