Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion code/logic/fossil/io/stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ extern "C" {
* Structure representing a file stream.
*/
typedef struct {
FILE *file; // Pointer to the FILE structure for the stream
FILE *file; // Pointer to the FILE structure for the stream
char filename[500]; // Array to store the filename
} fossil_fstream_t;

Expand Down Expand Up @@ -71,6 +71,16 @@ int32_t fossil_fstream_open(fossil_fstream_t *stream, const char *filename, cons
*/
void fossil_fstream_close(fossil_fstream_t *stream);

/**
* Redirect a stream to /dev/null.
*
* This function redirects the given stream to /dev/null, effectively discarding any data written to it.
*
* @param stream Pointer to the fossil_fstream_t structure to redirect.
* @return 0 on success, non-zero on failure.
*/
int32_t fossil_fstream_redirect_to_devnull(fossil_fstream_t *stream);

/**
* Check if a stream is open.
*
Expand Down Expand Up @@ -418,6 +428,18 @@ namespace fossil {
fossil_fstream_close(stream);
}

/**
* Redirect a stream to /dev/null.
*
* This function redirects the given stream to /dev/null, effectively discarding any data written to it.
*
* @param stream Pointer to the fossil_fstream_t structure to redirect.
* @return 0 on success, non-zero on failure.
*/
static int32_t redirect_to_devnull(fossil_fstream_t *stream) {
return fossil_fstream_redirect_to_devnull(stream);
}

/**
* Check if a stream is open.
*
Expand Down
Loading