From 57ebf3b3238a165c1973ecdf96ba79f95d650fc9 Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Thu, 15 Oct 2026 12:29:25 +0300 Subject: Add soversion, version macros, and reserved term_options words The shared library now carries its major version in the SONAME (libterm.so.0), so an ABI break gets a new file name. The header gains TERM_VERSION, TERM_VERSION_MAJOR/MINOR/PATCH and TERM_VERSION_CODE, and term_version() returns the code the library was built with. A test checks the macros against meson.build's project version and against the runtime value. term_options ends with uint32_t reserved[8]. term_new() returns NULL if a word is nonzero, so later versions can give those words a meaning without misreading a caller's leftover data. All-zero options stay valid. Co-Authored-By: Claude Haiku 5.5 --- tests/term_test.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests/term_test.c') diff --git a/tests/term_test.c b/tests/term_test.c index 66dbd96..2040e20 100644 --- a/tests/term_test.c +++ b/tests/term_test.c @@ -1832,8 +1832,30 @@ static void test_concurrent_feed_and_snapshot(void) term_free(t); } +static void test_reserved_options_must_be_zero(void) +{ + struct term_options opt = { .size = { .x = 10, .y = 2 } }; + struct term *t = term_new(&opt); + assert(t != NULL); + term_free(t); + + size_t words = sizeof(opt.reserved) / sizeof(opt.reserved[0]); + for (size_t i = 0; i < words; i++) { + opt.reserved[i] = 1; + assert(term_new(&opt) == NULL); + opt.reserved[i] = 0; + } + opt.reserved[words - 1] = 0x80000000u; + assert(term_new(&opt) == NULL); + opt.reserved[words - 1] = 0; + t = term_new(&opt); + assert(t != NULL); + term_free(t); +} + int main(void) { + test_reserved_options_must_be_zero(); test_concurrent_feed_and_snapshot(); test_grow_past_reservation(); test_skipped_cells_read_blank(); -- cgit v1.2.3