aboutsummaryrefslogtreecommitdiff
path: root/arraylist.c
diff options
context:
space:
mode:
authorThomas Schmucker <ts@its1.de>2020-11-11 20:38:08 +0100
committerThomas Schmucker <ts@its1.de>2020-11-11 20:38:08 +0100
commita594ea35a36e644d3bd7235352857b2c9f87973a (patch)
tree1e6f3d3743219a4ef08b9f6907680705e551b910 /arraylist.c
parentf320cd9027b9bee52442e8c58d2f3b2281c87bfc (diff)
downloaddata-structures-a594ea35a36e644d3bd7235352857b2c9f87973a.tar.gz
data-structures-a594ea35a36e644d3bd7235352857b2c9f87973a.tar.bz2
data-structures-a594ea35a36e644d3bd7235352857b2c9f87973a.zip
zusätzliches Argument beim linearen Suchen hinzugefügt, damit die Schnittstellen wieder identisch sind!
Diffstat (limited to 'arraylist.c')
-rw-r--r--arraylist.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arraylist.c b/arraylist.c
index 982e466..f72d3e2 100644
--- a/arraylist.c
+++ b/arraylist.c
@@ -194,14 +194,14 @@ ArrayList_sort(struct ArrayList *arrayList, int cmp(const T *, const T *, void *
194} 194}
195 195
196bool 196bool
197ArrayList_linearSearch(struct ArrayList *arrayList, void *key, int cmp(void *, const T *), size_t *loc) 197ArrayList_linearSearch(struct ArrayList *arrayList, void *key, int cmp(void *, const T *, void *), void *args, size_t *loc)
198{ 198{
199 assert(arrayList != NULL); 199 assert(arrayList != NULL);
200 assert(cmp != NULL); 200 assert(cmp != NULL);
201 assert(loc != NULL); 201 assert(loc != NULL);
202 202
203 for ( size_t idx = 0; idx != arrayList->size; ++idx ) { 203 for ( size_t idx = 0; idx != arrayList->size; ++idx ) {
204 if ( cmp(key, arrayList->array[idx]) == 0 ) { 204 if ( cmp(key, arrayList->array[idx], args) == 0 ) {
205 *loc = idx; 205 *loc = idx;
206 return true; 206 return true;
207 } 207 }