diff options
author | Lennart Poettering <lennart@poettering.net> | 2024-10-15 15:32:55 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2024-10-15 18:20:27 +0200 |
commit | 8a0adc973a24b24a06f797749724d1f79844032c (patch) | |
tree | 722bc0f25d7ac0fd21e80692808c79b423e25aea /src/basic/fileio.h | |
parent | core: do not fail if ignorable img.v/ vpick dir is missing (diff) | |
download | systemd-8a0adc973a24b24a06f797749724d1f79844032c.tar.xz systemd-8a0adc973a24b24a06f797749724d1f79844032c.zip |
fileio: clean up write_string_file() naming
let's rename the "_ts" flavour of these calls "_full" instead, exposing
the full functionality. And then keep two more minimal versions around:
one "_at" (which has the ts parameter suppressed, but keeps the dir_fd
one). And one without suffix (which supresses both).
Do the same for the label versions of these calls.
Diffstat (limited to 'src/basic/fileio.h')
-rw-r--r-- | src/basic/fileio.h | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/basic/fileio.h b/src/basic/fileio.h index 6986ed3276..dc514e3ccc 100644 --- a/src/basic/fileio.h +++ b/src/basic/fileio.h @@ -51,25 +51,21 @@ DIR* take_fdopendir(int *dfd); FILE* open_memstream_unlocked(char **ptr, size_t *sizeloc); FILE* fmemopen_unlocked(void *buf, size_t size, const char *mode); -int write_string_stream_ts(FILE *f, const char *line, WriteStringFileFlags flags, const struct timespec *ts); +int write_string_stream_full(FILE *f, const char *line, WriteStringFileFlags flags, const struct timespec *ts); static inline int write_string_stream(FILE *f, const char *line, WriteStringFileFlags flags) { - return write_string_stream_ts(f, line, flags, NULL); + return write_string_stream_full(f, line, flags, /* ts= */ NULL); } -int write_string_file_ts_at(int dir_fd, const char *fn, const char *line, WriteStringFileFlags flags, const struct timespec *ts); -static inline int write_string_file_ts(const char *fn, const char *line, WriteStringFileFlags flags, const struct timespec *ts) { - return write_string_file_ts_at(AT_FDCWD, fn, line, flags, ts); +int write_string_file_full(int dir_fd, const char *fn, const char *line, WriteStringFileFlags flags, const struct timespec *ts); +static inline int write_string_file(const char *fn, const char *line, WriteStringFileFlags flags) { + return write_string_file_full(AT_FDCWD, fn, line, flags, /* ts= */ NULL); } static inline int write_string_file_at(int dir_fd, const char *fn, const char *line, WriteStringFileFlags flags) { - return write_string_file_ts_at(dir_fd, fn, line, flags, NULL); -} -static inline int write_string_file(const char *fn, const char *line, WriteStringFileFlags flags) { - return write_string_file_ts(fn, line, flags, NULL); + return write_string_file_full(dir_fd, fn, line, flags, /* ts= */ NULL); } +int write_string_filef(const char *fn, WriteStringFileFlags flags, const char *format, ...) _printf_(3, 4); int write_base64_file_at(int dir_fd, const char *fn, const struct iovec *data, WriteStringFileFlags flags); -int write_string_filef(const char *fn, WriteStringFileFlags flags, const char *format, ...) _printf_(3, 4); - int read_one_line_file_at(int dir_fd, const char *filename, char **ret); static inline int read_one_line_file(const char *filename, char **ret) { return read_one_line_file_at(AT_FDCWD, filename, ret); |