Skip to content

Commit 93644fc

Browse files
Minor formatting
1 parent 75a8cfa commit 93644fc

File tree

6 files changed

+13
-18
lines changed

6 files changed

+13
-18
lines changed

.clang-format

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ InsertNewlineAtEOF: true
8383
IfMacros:
8484
- mlib_math_catch
8585
- amongoc_if_error
86+
ForEachMacros:
87+
- bson_foreach
8688
AllowBreakBeforeNoexceptSpecifier: Always
8789
---
8890
# For some reason, Clang sees some files as Objective-C. Add this section just to appease it.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ build:
3535
test: build
3636
cmake -E chdir "$(BUILD_DIR)" ctest -C "$(CONFIG)" --output-on-failure -j8
3737

38-
all_sources := $(shell find $(THIS_DIR)/src/ $(THIS_DIR)/include/ $(THIS_DIR)/tests/ -name '*.c' -o -name '*.cpp' -o -name '*.h' -o -name '*.hpp')
38+
all_sources := $(shell find $(THIS_DIR)/src/ $(THIS_DIR)/include/ $(THIS_DIR)/tests/ $(THIS_DIR)/docs/ -name '*.c' -o -name '*.cpp' -o -name '*.h' -o -name '*.hpp')
3939
format-check: poetry-install
4040
$(POETRY) run python tools/include-fixup.py --check
4141
$(POETRY) run $(MAKE) _format-check

docs/learn/bson/bson.example.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#include "bson/iterator.h"
2-
#include "bson/mut.h"
3-
#include "bson/types.h"
4-
#include "bson/view.h"
51
#include <bson/doc.h>
2+
#include <bson/iterator.h>
3+
#include <bson/mut.h>
4+
#include <bson/types.h>
5+
#include <bson/view.h>
66

77
// ex: [create-c]
88
#include <bson/doc.h>
@@ -157,7 +157,7 @@ void do_loop(bson_view data) {
157157

158158
// ex: [foreach]
159159
void foreach_loop(bson_view data) {
160-
bson_foreach(it, data) {
160+
bson_foreach (it, data) {
161161
// `it` refers to the current element.
162162
printf("Got an element: %s\n", bson_key(it).data);
163163
}
@@ -207,7 +207,7 @@ bool subdoc_iter(bson_view top) {
207207
}
208208

209209
// Iterate over each element of the array
210-
bson_foreach(sub_iter, val.array) {
210+
bson_foreach (sub_iter, val.array) {
211211
if (bson_iterator_get_error(sub_iter)) {
212212
// Iterating over a child element encountered an error
213213
fprintf(stderr,

docs/learn/read.example.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
1-
#include "amongoc/async.h"
2-
#include "amongoc/box.h"
3-
#include "amongoc/client.h"
4-
#include "amongoc/collection.h"
5-
#include "amongoc/default_loop.h"
61
#include <amongoc/amongoc.h>
72

8-
#include "bson/format.h"
9-
103
// Application state
114
typedef struct {
125
// The client

src/bson/view.test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ TEST_CASE("bson/view/foreach/break") {
174174
bson_iterator last_seen{};
175175
int nth = 0;
176176
// There are three elements, but we stop at two
177-
bson_foreach(iter, v) {
177+
bson_foreach (iter, v) {
178178
last_seen = iter;
179179
++nth;
180180
if (nth == 2) {
@@ -219,7 +219,7 @@ TEST_CASE("bson/view/foreach/error iterator") {
219219

220220
int nth = 0;
221221
bool got_error = false;
222-
bson_foreach(iter, v) {
222+
bson_foreach (iter, v) {
223223
switch (nth++) {
224224
case 0:
225225
CHECK(iter->key() == "r");
@@ -252,7 +252,7 @@ TEST_CASE("bson/view/foreach/Once evaluation") {
252252
return doc;
253253
};
254254

255-
bson_foreach(it, get()) {
255+
bson_foreach (it, get()) {
256256
(void)it;
257257
// Empty
258258
}

tools/include-fixup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"**/*.hpp",
2424
]
2525

26-
dirs = ["src/", "include/"]
26+
dirs = ["src/", "include/", "tests/", "docs/"]
2727

2828
dirs = map(Path, dirs)
2929
source_files = itertools.chain.from_iterable(

0 commit comments

Comments
 (0)