diff options
| author | Thomas Schmucker <ts@its1.de> | 2020-11-11 20:38:08 +0100 |
|---|---|---|
| committer | Thomas Schmucker <ts@its1.de> | 2020-11-11 20:38:08 +0100 |
| commit | a594ea35a36e644d3bd7235352857b2c9f87973a (patch) | |
| tree | 1e6f3d3743219a4ef08b9f6907680705e551b910 /arraylist.c | |
| parent | f320cd9027b9bee52442e8c58d2f3b2281c87bfc (diff) | |
| download | data-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.c | 4 |
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 | ||
| 196 | bool | 196 | bool |
| 197 | ArrayList_linearSearch(struct ArrayList *arrayList, void *key, int cmp(void *, const T *), size_t *loc) | 197 | ArrayList_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 | } |
