From 5c7fb0fabd331327ce298fcd35c8bb32dc4bf101 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Mon, 9 Feb 2026 08:34:48 +0000 Subject: [PATCH] stream: stream_stop -> stream_free --- include/alisp/stream.h | 2 +- src/stream.c | 2 +- test/test_stream.c | 18 +++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/alisp/stream.h b/include/alisp/stream.h index d5842df..d58bece 100644 --- a/include/alisp/stream.h +++ b/include/alisp/stream.h @@ -57,7 +57,7 @@ stream_err_t stream_init_pipe(stream_t *, const char *, FILE *); // descriptor. Use with caution. stream_err_t stream_init_file(stream_t *, const char *, FILE *); void stream_reset(stream_t *); -void stream_stop(stream_t *); +void stream_free(stream_t *); // End of Content (i.e. we've consumed all cached content/file) bool stream_eoc(stream_t *); diff --git a/src/stream.c b/src/stream.c index d85ef8f..41afb94 100644 --- a/src/stream.c +++ b/src/stream.c @@ -107,7 +107,7 @@ void stream_reset(stream_t *stream) stream->position = 0; } -void stream_stop(stream_t *stream) +void stream_free(stream_t *stream) { if (!stream) return; diff --git a/test/test_stream.c b/test/test_stream.c index 3807789..0be6d80 100644 --- a/test/test_stream.c +++ b/test/test_stream.c @@ -82,7 +82,7 @@ void stream_test_string(void) test_strings[i].size); TEST(!stream_eoc(&stream), "Not end of content already"); - stream_stop(&stream); + stream_free(&stream); TEST(strncmp(copy.data, test_strings[i].data, copy.size) == 0, "Freeing a stream does not free the underlying memory it was derived " "from"); @@ -96,7 +96,7 @@ void stream_test_string(void) stream_err_to_cstr(err)); TEST(stream_size(&stream) == 0, "NULL stream size is 0"); TEST(stream_eoc(&stream), "NULL stream is always at end of content"); - stream_stop(&stream); + stream_free(&stream); TEST_END(); } @@ -114,7 +114,7 @@ void stream_test_file(void) stream_err_to_cstr(err)); } TEST(!stream_eoc(&stream), "Stream should not be at the EoC from init."); - stream_stop(&stream); + stream_free(&stream); } // try to initialise the stream again but against a nonexistent file - we're @@ -163,7 +163,7 @@ void stream_test_peek_next(void) "(%c)", c3, c2); - stream_stop(&stream); + stream_free(&stream); } // Invalid streams @@ -180,7 +180,7 @@ void stream_test_peek_next(void) "Next on an invalid stream should not affect position (%lu -> %lu)", old_position, stream.position); - stream_stop(&stream); + stream_free(&stream); } TEST_END(); } @@ -209,7 +209,7 @@ void stream_test_seek(void) "stream (%lu -> %lu)", old_position, stream.position); - stream_stop(&stream); + stream_free(&stream); } // Valid streams @@ -267,7 +267,7 @@ void stream_test_seek(void) "above.", stream.position); - stream_stop(&stream); + stream_free(&stream); } TEST_END(); @@ -301,7 +301,7 @@ void stream_test_substr(void) position, size); } - stream_stop(&stream); + stream_free(&stream); } // Taking substrings of valid streams @@ -376,7 +376,7 @@ void stream_test_substr(void) } } - stream_stop(&stream); + stream_free(&stream); } TEST_END(); }