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>
Šī revīzija ir iekļauta:
Lars Hjemli
2009-08-18 17:17:41 +02:00
vecāks 523c133e2e
revīzija e16f178334
4 mainīti faili ar 34 papildinājumiem un 23 dzēšanām

1
cgit.h
Parādīt failu

@@ -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 */