• Richard Fitzgerald's avatar
    kunit: string-stream: Add kunit_alloc_string_stream() · 20631e15
    Richard Fitzgerald authored
    Add function kunit_alloc_string_stream() to do a resource-managed
    allocation of a string stream, and corresponding
    kunit_free_string_stream() to free the resource-managed stream.
    
    This is preparing for decoupling the string_stream
    implementation from struct kunit, to reduce the amount of code
    churn when that happens. Currently:
     - kunit_alloc_string_stream() only calls alloc_string_stream().
     - kunit_free_string_stream() takes a struct kunit* which
       isn't used yet.
    
    Callers of the old alloc_string_stream() and
    string_stream_destroy() are all requesting a managed allocation
    so have been changed to use the new functions.
    
    alloc_string_stream() has been temporarily made static because
    its current behavior has been replaced with
    kunit_alloc_string_stream().
    Signed-off-by: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
    Reviewed-by: default avatarDavid Gow <davidgow@google.com>
    Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
    20631e15
string-stream-test.c 11.3 KB