Skip to content

Commit

Permalink
add stdioext.h
Browse files Browse the repository at this point in the history
  • Loading branch information
SolDev69 committed Dec 11, 2023
1 parent 0793bba commit f4c2a5c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/util/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ endif
subdir('blake3')

files_mesa_util = files(
'stdioext.h',
'anon_file.h',
'anon_file.c',
'bigmath.h',
Expand Down
28 changes: 28 additions & 0 deletions src/util/stdioext.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ifndef _STDIOEXT_H
#define _STDIOEXT_H

#ifdef __cplusplus
extern "C" {
#endif

#include <stdio.h>
#include <stdint.h>

typedef struct cookie_io_functions_t {
ssize_t (*read)(void *cookie, char *buf, size_t n);
ssize_t (*write)(void *cookie, const char *buf, size_t n);
int (*seek)(void *cookie, off_t *pos, int whence);
int (*close)(void *cookie);
} cookie_io_functions_t;

FILE *fopencookie(void *cookie, const char *mode, cookie_io_functions_t functions);

FILE *fmemopen(void *buf, size_t size, const char *mode);

FILE *open_memstream(char **buf, size_t *size);

#ifdef __cplusplus
} // extern "C"
#endif

#endif /* _STDIOEXT_H */

0 comments on commit f4c2a5c

Please sign in to comment.