summaryrefslogtreecommitdiff
path: root/toxcore/list.c
diff options
context:
space:
mode:
authorMarc Schütz <schuetzm@gmx.net>2014-06-10 18:42:52 +0200
committerMarc Schütz <schuetzm@gmx.net>2014-06-10 18:42:52 +0200
commite651cc9984d982a2d55d4f3ac4673b727a7341a3 (patch)
tree4395e3b24f33d040b53d59f6d1903aee7fe00203 /toxcore/list.c
parent55d986270b3af91019dabfb2169817cd894d84fe (diff)
Const correctness in toxcore/list.c
Diffstat (limited to 'toxcore/list.c')
-rw-r--r--toxcore/list.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/toxcore/list.c b/toxcore/list.c
index ce3968fd..dc57911f 100644
--- a/toxcore/list.c
+++ b/toxcore/list.c
@@ -45,7 +45,7 @@
45 * < 0 : no match, returns index (return value is INDEX(index)) where 45 * < 0 : no match, returns index (return value is INDEX(index)) where
46 * the data should be inserted 46 * the data should be inserted
47 */ 47 */
48static int find(BS_LIST *list, void *data) 48static int find(const BS_LIST *list, const void *data)
49{ 49{
50 //should work well, but could be improved 50 //should work well, but could be improved
51 if (list->n == 0) { 51 if (list->n == 0) {
@@ -115,14 +115,14 @@ void bs_list_init(BS_LIST *list, uint32_t element_size)
115 list->ids = NULL; 115 list->ids = NULL;
116} 116}
117 117
118void bs_list_free(BS_LIST *list) 118void bs_list_free(const BS_LIST *list)
119{ 119{
120 //free both arrays 120 //free both arrays
121 free(list->data); 121 free(list->data);
122 free(list->ids); 122 free(list->ids);
123} 123}
124 124
125int bs_list_find(BS_LIST *list, void *data) 125int bs_list_find(const BS_LIST *list, const void *data)
126{ 126{
127 int r = find(list, data); 127 int r = find(list, data);
128 128
@@ -134,7 +134,7 @@ int bs_list_find(BS_LIST *list, void *data)
134 return list->ids[r]; 134 return list->ids[r];
135} 135}
136 136
137int bs_list_add(BS_LIST *list, void *data, int id) 137int bs_list_add(BS_LIST *list, const void *data, int id)
138{ 138{
139 //find where the new element should be inserted 139 //find where the new element should be inserted
140 //see: return value of find() 140 //see: return value of find()
@@ -180,7 +180,7 @@ int bs_list_add(BS_LIST *list, void *data, int id)
180 return 1; 180 return 1;
181} 181}
182 182
183int bs_list_remove(BS_LIST *list, void *data, int id) 183int bs_list_remove(BS_LIST *list, const void *data, int id)
184{ 184{
185 int i = find(list, data); 185 int i = find(list, data);
186 186