Changeset fe7ece2 for messagelist.c
- Timestamp:
- Jul 9, 2011, 4:10:45 PM (13 years ago)
- Parents:
- 786a410 (diff), caac19d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
messagelist.c
r901cee9 rfe7ece2 30 30 } 31 31 32 owl_message *owl_messagelist_get_by_id(const owl_messagelist *ml, int target_id)32 int owl_messagelist_get_index_by_id(const owl_messagelist *ml, int target_id) 33 33 { 34 /* return the message with id == 'id'. If it doesn't exist return NULL. */34 /* return the message index with id == 'id'. If it doesn't exist return -1. */ 35 35 int first, last, mid, msg_id; 36 36 owl_message *m; … … 43 43 msg_id = owl_message_get_id(m); 44 44 if (msg_id == target_id) { 45 return (m);45 return mid; 46 46 } else if (msg_id < target_id) { 47 47 first = mid + 1; … … 50 50 } 51 51 } 52 return(NULL); 52 return -1; 53 } 54 55 owl_message *owl_messagelist_get_by_id(const owl_messagelist *ml, int target_id) 56 { 57 /* return the message with id == 'id'. If it doesn't exist return NULL. */ 58 int n = owl_messagelist_get_index_by_id(ml, target_id); 59 if (n < 0) return NULL; 60 return ml->list->pdata[n]; 53 61 } 54 62 … … 71 79 owl_message_unmark_delete(ml->list->pdata[n]); 72 80 return(0); 81 } 82 83 void owl_messagelist_delete_and_expunge_element(owl_messagelist *ml, int n) 84 { 85 owl_message_delete(g_ptr_array_remove_index(ml->list, n)); 73 86 } 74 87
Note: See TracChangeset
for help on using the changeset viewer.