stream: Make stream name a constant cstr

We don't deal with the memory for it anyway.
This commit is contained in:
2026-02-05 18:52:47 +00:00
parent f7cfe16c67
commit 0318dcbb65
2 changed files with 8 additions and 7 deletions

View File

@@ -40,7 +40,7 @@ typedef struct
typedef struct typedef struct
{ {
stream_type_t type; stream_type_t type;
char *name; const char *name;
u64 position; u64 position;
union union
{ {
@@ -51,9 +51,9 @@ typedef struct
#define STREAM_DEFAULT_CHUNK 64 #define STREAM_DEFAULT_CHUNK 64
stream_err_t stream_init_string(stream_t *, char *, sv_t); stream_err_t stream_init_string(stream_t *, const char *, sv_t);
stream_err_t stream_init_pipe(stream_t *, char *, FILE *); stream_err_t stream_init_pipe(stream_t *, const char *, FILE *);
stream_err_t stream_init_file(stream_t *, char *, FILE *); stream_err_t stream_init_file(stream_t *, const char *, FILE *);
void stream_stop(stream_t *); void stream_stop(stream_t *);
// End of Content (i.e. we've consumed all cached content/file) // End of Content (i.e. we've consumed all cached content/file)

View File

@@ -35,7 +35,8 @@ const char *stream_err_to_cstr(stream_err_t err)
} }
} }
stream_err_t stream_init_string(stream_t *stream, char *name, sv_t contents) stream_err_t stream_init_string(stream_t *stream, const char *name,
sv_t contents)
{ {
if (!stream) if (!stream)
return STREAM_ERR_INVALID_PTR; return STREAM_ERR_INVALID_PTR;
@@ -49,7 +50,7 @@ stream_err_t stream_init_string(stream_t *stream, char *name, sv_t contents)
return STREAM_ERR_OK; return STREAM_ERR_OK;
} }
stream_err_t stream_init_pipe(stream_t *stream, char *name, FILE *pipe) stream_err_t stream_init_pipe(stream_t *stream, const char *name, FILE *pipe)
{ {
if (!stream) if (!stream)
return STREAM_ERR_INVALID_PTR; return STREAM_ERR_INVALID_PTR;
@@ -68,7 +69,7 @@ stream_err_t stream_init_pipe(stream_t *stream, char *name, FILE *pipe)
return STREAM_ERR_OK; return STREAM_ERR_OK;
} }
stream_err_t stream_init_file(stream_t *stream, char *name, FILE *pipe) stream_err_t stream_init_file(stream_t *stream, const char *name, FILE *pipe)
{ {
if (!stream) if (!stream)
return STREAM_ERR_INVALID_PTR; return STREAM_ERR_INVALID_PTR;