Changeset efeec7f for messagelist.c
- Timestamp:
- Jul 9, 2011, 4:11:45 PM (13 years ago)
- Branches:
- master, release-1.10, release-1.8, release-1.9
- Children:
- a130fc5
- Parents:
- 3eeb6ed
- git-author:
- Jason Gross <jgross@mit.edu> (05/23/11 19:06:48)
- git-committer:
- Jason Gross <jgross@mit.edu> (07/09/11 16:11:45)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
messagelist.c
r901cee9 refeec7f 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.