Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revisit decision to copy strings and memory buffers into allocated memory #33

Open
malsyned opened this issue Oct 8, 2017 · 0 comments

Comments

@malsyned
Copy link
Owner

malsyned commented Oct 8, 2017

the_string and the_memory copy the buffer that is passed to them into a freshly allocated new buffer. Why have I done this? I think only to support this use pattern:

static char *make_me_a_string(void)
{
    char stack_string[] = "foo";
    return stack_string;
}

test(foo) {
    assert_that(the_string(make_me_a_string()), is_the_string("foo"));
}

However, is this pattern really likely? And if it is, wouldn't the user be better advised to pfstest_alloc the buffer requiring dynamic extent themselves?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant