
Move the memstream code into common code. Other Rust code interfacing with FILE pointers will find the memstream abstraction useful. Most notably, pinning is actually enforced this time with PhantomPinned. Add a .clang-format from a sibling dir (i.e.: compiler/nir) while we're at it to keep things tidy. Signed-off-by: Daniel Almeida <daniel.almeida@collabora.com> Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30594>
29 lines
519 B
C
29 lines
519 B
C
/*
|
|
* Copyright © 2024 Collabora, Ltd.
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
* This file contains helpers that are implemented in C so that, among other
|
|
* things, we avoid pulling in all of libc as bindings only to access a few
|
|
* functions.
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
#include "rust_helpers.h"
|
|
|
|
void compiler_rs_free(void *ptr)
|
|
{
|
|
free(ptr);
|
|
}
|
|
|
|
long compiler_rs_ftell(FILE *f)
|
|
{
|
|
return ftell(f);
|
|
}
|
|
|
|
int compiler_rs_fseek(FILE *f, long offset, int whence)
|
|
{
|
|
return fseek(f, offset, whence);
|
|
}
|