Skip to content

Commit dfd158b

Browse files
committed
CDRIVER-424 C89 is a thing still -> because Windows
1 parent 326a7c6 commit dfd158b

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/mongoc/mongoc-cluster.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,8 @@ _mongoc_cluster_select (mongoc_cluster_t *cluster,
617617
{
618618
mongoc_cluster_node_t *nodes[MONGOC_CLUSTER_MAX_NODES];
619619
mongoc_read_mode_t read_mode = MONGOC_READ_PRIMARY;
620+
int scores[MONGOC_CLUSTER_MAX_NODES];
621+
int max_score = 0;
620622
uint32_t count;
621623
uint32_t watermark;
622624
int32_t nearest = -1;
@@ -743,9 +745,6 @@ _mongoc_cluster_select (mongoc_cluster_t *cluster,
743745

744746
count = 0;
745747

746-
int scores[MONGOC_CLUSTER_MAX_NODES];
747-
int max_score = 0;
748-
749748
for (i = 0; i < MONGOC_CLUSTER_MAX_NODES; i++) {
750749
if (nodes[i]) {
751750
if (read_prefs) {

src/mongoc/mongoc-read-prefs.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -155,34 +155,36 @@ _score_tags (const bson_t *read_tags,
155155

156156
count = bson_count_keys(read_tags);
157157

158-
// Execute this block if read tags were provided, else bail and return 0 (all nodes equal)
158+
/* Execute this block if read tags were provided, else bail and return 0 (all nodes equal) */
159159
if (!bson_empty(read_tags) && bson_iter_init(&iter, read_tags)) {
160160

161-
// Iterate over array of read tag sets provided (each element is a tag set)
162-
// Tag sets are provided in order of preference so return the count of the
163-
// first set that matches the node or -1 if no set matched the node.
161+
/*
162+
* Iterate over array of read tag sets provided (each element is a tag set)
163+
* Tag sets are provided in order of preference so return the count of the
164+
* first set that matches the node or -1 if no set matched the node.
165+
*/
164166
while (count && bson_iter_next(&iter)) {
165167
if (BSON_ITER_HOLDS_DOCUMENT(&iter) && bson_iter_recurse(&iter, &sub_iter)) {
166168
node_matches_set = true;
167169

168-
// Iterate over the key/value pairs (tags) in the current set
170+
/* Iterate over the key/value pairs (tags) in the current set */
169171
while (bson_iter_next(&sub_iter) && BSON_ITER_HOLDS_UTF8(&sub_iter)) {
170172
key = bson_iter_key(&sub_iter);
171173
str = bson_iter_utf8(&sub_iter, &len);
172174

173-
// If any of the tags do not match, this node cannot satisfy this tag set.
175+
/* If any of the tags do not match, this node cannot satisfy this tag set. */
174176
if (!_contains_tag(node_tags, key, str, len)) {
175177
node_matches_set = false;
176178
break;
177179
}
178180
}
179181

180-
// This set matched, return the count as the score
182+
/* This set matched, return the count as the score */
181183
if (node_matches_set) {
182184
return count;
183185
}
184186

185-
// Decrement the score and try to match the next set.
187+
/* Decrement the score and try to match the next set. */
186188
count--;
187189
}
188190
}

0 commit comments

Comments
 (0)