Skip to content

Commit 4b82528

Browse files
committed
Expose the compile-time page size setting
1 parent ae3ba90 commit 4b82528

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

strings.c

+4
Original file line numberDiff line numberDiff line change
@@ -341,3 +341,7 @@ size_t strings_allocated_bytes(const struct strings *strings) {
341341
block_allocated_bytes(strings->tree_nodes) +
342342
sizeof(*strings);
343343
}
344+
345+
size_t strings_page_size() {
346+
return PAGE_SIZE;
347+
}

strings.h

+3
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,7 @@ bool strings_restore(struct strings*, const struct strings_snapshot*);
7171
// Get the total bytes allocated, including overhead
7272
size_t strings_allocated_bytes(const struct strings*);
7373

74+
// Get the page size
75+
size_t strings_page_size();
76+
7477
#endif

tests.c

+2
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ int main() {
163163
}
164164
assert(strings_intern(strings, "foobar") == count / 2 + 1);
165165

166+
assert(strings_page_size() == PAGE_SIZE);
167+
166168
strings_free(strings);
167169
return 0;
168170
}

0 commit comments

Comments
 (0)