stream: stream_stop -> stream_free

This commit is contained in:
2026-02-09 08:34:48 +00:00
committed by oreodave
parent f164427b47
commit 5c7fb0fabd
3 changed files with 11 additions and 11 deletions

View File

@@ -57,7 +57,7 @@ stream_err_t stream_init_pipe(stream_t *, const char *, FILE *);
// descriptor. Use with caution. // descriptor. Use with caution.
stream_err_t stream_init_file(stream_t *, const char *, FILE *); stream_err_t stream_init_file(stream_t *, const char *, FILE *);
void stream_reset(stream_t *); 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) // End of Content (i.e. we've consumed all cached content/file)
bool stream_eoc(stream_t *); bool stream_eoc(stream_t *);

View File

@@ -107,7 +107,7 @@ void stream_reset(stream_t *stream)
stream->position = 0; stream->position = 0;
} }
void stream_stop(stream_t *stream) void stream_free(stream_t *stream)
{ {
if (!stream) if (!stream)
return; return;

View File

@@ -82,7 +82,7 @@ void stream_test_string(void)
test_strings[i].size); test_strings[i].size);
TEST(!stream_eoc(&stream), "Not end of content already"); 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, TEST(strncmp(copy.data, test_strings[i].data, copy.size) == 0,
"Freeing a stream does not free the underlying memory it was derived " "Freeing a stream does not free the underlying memory it was derived "
"from"); "from");
@@ -96,7 +96,7 @@ void stream_test_string(void)
stream_err_to_cstr(err)); stream_err_to_cstr(err));
TEST(stream_size(&stream) == 0, "NULL stream size is 0"); TEST(stream_size(&stream) == 0, "NULL stream size is 0");
TEST(stream_eoc(&stream), "NULL stream is always at end of content"); TEST(stream_eoc(&stream), "NULL stream is always at end of content");
stream_stop(&stream); stream_free(&stream);
TEST_END(); TEST_END();
} }
@@ -114,7 +114,7 @@ void stream_test_file(void)
stream_err_to_cstr(err)); stream_err_to_cstr(err));
} }
TEST(!stream_eoc(&stream), "Stream should not be at the EoC from init."); 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 // try to initialise the stream again but against a nonexistent file - we're
@@ -163,7 +163,7 @@ void stream_test_peek_next(void)
"(%c)", "(%c)",
c3, c2); c3, c2);
stream_stop(&stream); stream_free(&stream);
} }
// Invalid streams // Invalid streams
@@ -180,7 +180,7 @@ void stream_test_peek_next(void)
"Next on an invalid stream should not affect position (%lu -> %lu)", "Next on an invalid stream should not affect position (%lu -> %lu)",
old_position, stream.position); old_position, stream.position);
stream_stop(&stream); stream_free(&stream);
} }
TEST_END(); TEST_END();
} }
@@ -209,7 +209,7 @@ void stream_test_seek(void)
"stream (%lu -> %lu)", "stream (%lu -> %lu)",
old_position, stream.position); old_position, stream.position);
stream_stop(&stream); stream_free(&stream);
} }
// Valid streams // Valid streams
@@ -267,7 +267,7 @@ void stream_test_seek(void)
"above.", "above.",
stream.position); stream.position);
stream_stop(&stream); stream_free(&stream);
} }
TEST_END(); TEST_END();
@@ -301,7 +301,7 @@ void stream_test_substr(void)
position, size); position, size);
} }
stream_stop(&stream); stream_free(&stream);
} }
// Taking substrings of valid streams // Taking substrings of valid streams
@@ -376,7 +376,7 @@ void stream_test_substr(void)
} }
} }
stream_stop(&stream); stream_free(&stream);
} }
TEST_END(); TEST_END();
} }