25
25
* That is StringMap that points to the oval_collection objects.
26
26
*
27
27
* 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
29
29
* never empty.
30
30
*/
31
31
38
38
#include "oval_smc_impl.h"
39
39
40
40
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
44
44
};
45
45
46
46
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)
50
50
51
51
struct oval_smc_iterator * it = calloc (1 , sizeof (struct oval_smc_iterator ));
52
52
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 ;
56
56
return it ;
57
57
}
58
58
59
59
void oval_smc_iterator_free (struct oval_smc_iterator * it )
60
60
{
61
61
if (it == NULL )
62
62
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 );
66
66
free (it );
67
67
}
68
68
69
69
bool oval_smc_iterator_has_more (struct oval_smc_iterator * it )
70
70
{
71
71
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 )));
75
75
}
76
76
77
77
void * oval_smc_iterator_next (struct oval_smc_iterator * it )
78
78
{
79
79
if (it == NULL )
80
80
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 ;
86
86
}
87
- if (!oval_collection_iterator_has_more (it -> master_it )) {
87
+ if (!oval_collection_iterator_has_more (it -> primary_it )) {
88
88
assert (false);
89
89
return NULL ;
90
90
}
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 );
93
93
}
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 );
96
96
}
0 commit comments