mirror of
https://git.zx2c4.com/cgit
synced 2025-07-21 19:34:22 +02:00
Add and use a common readfile() function
This function is used to read the full content of a textfile into a newly allocated buffer (with zerotermination). It replaces the earlier readfile() in scan-tree.c (which was rather error-prone[1]), and is reused by read_agefile() in ui-repolist.c. 1: No checks for EINTR and EAGAIN, fixed-size buffer Signed-off-by: Lars Hjemli <hjemli@gmail.com>
This commit is contained in:
parent
523c133e2e
commit
e16f178334
4 changed files with 34 additions and 23 deletions
1
cgit.h
1
cgit.h
|
@ -283,5 +283,6 @@ extern int cgit_parse_snapshots_mask(const char *str);
|
|||
extern int cgit_open_filter(struct cgit_filter *filter);
|
||||
extern int cgit_close_filter(struct cgit_filter *filter);
|
||||
|
||||
extern int readfile(const char *path, char **buf, size_t *size);
|
||||
|
||||
#endif /* CGIT_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue