stream: stream_stop -> stream_free
This commit is contained in:
@@ -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 *);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user