Skip to content

Commit a5015ab

Browse files
authored
Merge pull request #1906 from matejak/iterator_naming
Improve naming and clarify comments
2 parents d348e67 + 3c0fa0e commit a5015ab

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

release_tools/naming.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ declare -A name_mapping
44
# name_mapping['<duplicate name>']='<canonical name>', e.g.
55
# Keep the assignments lexicographicaly sorted by the canonical name and then by the duplicate name.
66

7-
# If you want to blacklist a name, do e.g.
7+
# If you want to remove a name completely from the deduplicated listing, do e.g.
88
# name_mapping['root@localhost']=
99

1010
name_mapping['Martin Preisler <[email protected]>']='Martin Preisler <[email protected]>'

src/OVAL/adt/oval_smc_iterator.c

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* That is StringMap that points to the oval_collection objects.
2626
*
2727
* This module implements only sub set of iterator functionality for iterating
28-
* through map/list structure. Limits: It supposes that list (slave_col) is
28+
* through map/list structure. Limits: It supposes that list (secondary_col) is
2929
* never empty.
3030
*/
3131

@@ -38,9 +38,9 @@
3838
#include "oval_smc_impl.h"
3939

4040
struct oval_smc_iterator {
41-
struct oval_collection *master_col; ///< list of lists
42-
struct oval_iterator *master_it; ///< iterating through master_col
43-
struct oval_iterator *slave_it; ///< iterating through a single item of master_col
41+
struct oval_collection *primary_col; ///< list of lists
42+
struct oval_iterator *primary_it; ///< iterating through primary_col
43+
struct oval_iterator *secondary_it; ///< iterating through a single item of primary_col
4444
};
4545

4646
struct oval_smc_iterator *oval_smc_iterator_new(struct oval_smc *mapping)
@@ -50,47 +50,47 @@ struct oval_smc_iterator *oval_smc_iterator_new(struct oval_smc *mapping)
5050

5151
struct oval_smc_iterator *it = calloc(1, sizeof(struct oval_smc_iterator));
5252

53-
it->master_col = oval_string_map_collect_values((struct oval_string_map *) mapping, NULL);
54-
it->master_it = oval_collection_iterator(it->master_col);
55-
it->slave_it = NULL;
53+
it->primary_col = oval_string_map_collect_values((struct oval_string_map *) mapping, NULL);
54+
it->primary_it = oval_collection_iterator(it->primary_col);
55+
it->secondary_it = NULL;
5656
return it;
5757
}
5858

5959
void oval_smc_iterator_free(struct oval_smc_iterator *it)
6060
{
6161
if (it == NULL)
6262
return;
63-
oval_collection_free(it->master_col);
64-
oval_collection_iterator_free(it->master_it);
65-
oval_collection_iterator_free(it->slave_it);
63+
oval_collection_free(it->primary_col);
64+
oval_collection_iterator_free(it->primary_it);
65+
oval_collection_iterator_free(it->secondary_it);
6666
free(it);
6767
}
6868

6969
bool oval_smc_iterator_has_more(struct oval_smc_iterator *it)
7070
{
7171
return it != NULL &&
72-
(oval_collection_iterator_has_more(it->master_it) ||
73-
(it->slave_it &&
74-
oval_collection_iterator_has_more(it->slave_it)));
72+
(oval_collection_iterator_has_more(it->primary_it) ||
73+
(it->secondary_it &&
74+
oval_collection_iterator_has_more(it->secondary_it)));
7575
}
7676

7777
void *oval_smc_iterator_next(struct oval_smc_iterator *it)
7878
{
7979
if (it == NULL)
8080
return NULL;
81-
if (it->slave_it == NULL || !oval_collection_iterator_has_more(it->slave_it)) {
82-
// Rewind master and find new slave
83-
if (it->slave_it != NULL) {
84-
oval_collection_iterator_free(it->slave_it);
85-
it->slave_it = NULL;
81+
if (it->secondary_it == NULL || !oval_collection_iterator_has_more(it->secondary_it)) {
82+
// Rewind primary and find new secondary
83+
if (it->secondary_it != NULL) {
84+
oval_collection_iterator_free(it->secondary_it);
85+
it->secondary_it = NULL;
8686
}
87-
if (!oval_collection_iterator_has_more(it->master_it)) {
87+
if (!oval_collection_iterator_has_more(it->primary_it)) {
8888
assert(false);
8989
return NULL;
9090
}
91-
struct oval_collection *slave_col = (struct oval_collection *) oval_collection_iterator_next(it->master_it);
92-
it->slave_it = oval_collection_iterator(slave_col);
91+
struct oval_collection *secondary_col = (struct oval_collection *) oval_collection_iterator_next(it->primary_it);
92+
it->secondary_it = oval_collection_iterator(secondary_col);
9393
}
94-
assert(oval_collection_iterator_has_more(it->slave_it));
95-
return oval_collection_iterator_next(it->slave_it);
94+
assert(oval_collection_iterator_has_more(it->secondary_it));
95+
return oval_collection_iterator_next(it->secondary_it);
9696
}

0 commit comments

Comments
 (0)