# HG changeset patch # User Mike Becker # Date 1728830834 -7200 # Node ID 192a440b99df357aa03c8373084abbefac7a0926 # Parent d2d42cb1d59e87ccedcba1ecf0493cafa5ad72c9 fix totally bugged assertion in cxPropertiesUseStack() diff -r d2d42cb1d59e -r 192a440b99df src/properties.c --- a/src/properties.c Sun Oct 13 16:44:29 2024 +0200 +++ b/src/properties.c Sun Oct 13 16:47:14 2024 +0200 @@ -131,7 +131,7 @@ char *buf, size_t capacity ) { - assert(buf == NULL); + assert(prop->buf == NULL); prop->buf = buf; prop->buf_capacity = capacity; prop->buf_size = 0; diff -r d2d42cb1d59e -r 192a440b99df tests/test_properties.c --- a/tests/test_properties.c Sun Oct 13 16:44:29 2024 +0200 +++ b/tests/test_properties.c Sun Oct 13 16:47:14 2024 +0200 @@ -374,12 +374,15 @@ cx_testing_allocator_init(&talloc); CxAllocator *alloc = &talloc.base; CX_TEST_DO { + char buffer[512]; + CxProperties prop; + cxPropertiesInitDefault(&prop); + cxPropertiesUseStack(&prop, buffer, 512); + const char *str = "key1 = value1\nkey2 = value2\n\n#comment\n\nkey3 = value3\n"; CxMap *map = cxHashMapCreateSimple(CX_STORE_POINTERS); cxDefineAdvancedDestructor(map, cxFree, alloc); - CxProperties prop; - cxPropertiesInitDefault(&prop); CxPropertiesSink sink = cxPropertiesMapSink(map); sink.data = alloc; // use the testing allocator CxPropertiesSource src = cxPropertiesCstrSource(str);