aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-06-19 17:36:35 -0700
committerFuwn <[email protected]>2022-06-19 17:36:35 -0700
commitd2125c0098cc3f9cb3076cc8bfa5f7ba0c0ff0f4 (patch)
tree4d9f795df6858d6c3d341bd660f893736b61a15c
parentfix(context): use calloc for tag, read (diff)
downloadtatl-d2125c0098cc3f9cb3076cc8bfa5f7ba0c0ff0f4.tar.xz
tatl-d2125c0098cc3f9cb3076cc8bfa5f7ba0c0ff0f4.zip
refactor(context): avoid unnecessary malloc
-rw-r--r--src/context.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/context.c b/src/context.c
index 4793166..b7c25aa 100644
--- a/src/context.c
+++ b/src/context.c
@@ -70,17 +70,10 @@ void tatl_run(struct tatl_context *context) {
size_t i;
if (!context->_mute) {
- char *tag = malloc(strlen(context->_tag));
- size_t tag_length;
-
- strcpy(tag, context->_tag);
-
- tag_length = strlen(tag);
+ size_t tag_length = strlen(context->_tag);
printf("running %zd tests%s%s\n", context->_tests_size,
- tag_length > 0 ? " from " : "", tag_length > 0 ? tag : "");
-
- free(tag);
+ tag_length > 0 ? " from " : "", tag_length > 0 ? context->_tag : "");
}
for (i = 0; i != context->_names_size; ++i) {