[Commits] [SCM] claws branch, master, updated. 3.17.0-110-g2edb13e
Colin
colin at claws-mail.org
Wed Oct 10 10:09:26 CEST 2018
The branch, master has been updated
via 2edb13e5831d2e8b17274cf628a1ff1399da7bfd (commit)
from cb3f6bfba779f53100a9b21c09cb9489ad7469d0 (commit)
Summary of changes:
src/common/file-utils.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
- Log -----------------------------------------------------------------
commit 2edb13e5831d2e8b17274cf628a1ff1399da7bfd
Author: Colin Leroy <colin at colino.net>
Date: Wed Oct 10 10:09:11 2018 +0200
Comment the my_tmpfile_with_len() function.
diff --git a/src/common/file-utils.c b/src/common/file-utils.c
index 0d6d227..e4d7a5e 100644
--- a/src/common/file-utils.c
+++ b/src/common/file-utils.c
@@ -827,6 +827,19 @@ FILE *my_tmpfile(void)
return tmpfile();
}
+/* Returns a memory-backed FILE pointer to avoid file I/O
+ * where unnecessary. The "file" size is passed in the len
+ * parameter and is fixed: it's up to the caller to pass a
+ * large enough length to write to the FILE pointer. If the
+ * precise length isn't known, it is possible to ask for more.
+ *
+ * In this case, once writing to the pointer is done, the
+ * caller is responsible to call ftruncate(fileno(fp), ftell(fp))
+ * to make sure re-reading the stream will return EOF at the
+ * end of what we wrote.
+ * Otherwise, re-reading the stream will return uninitialized
+ * memory at the end of the stream.
+ */
FILE *my_tmpfile_with_len(size_t len)
{
#if HAVE_FMEMOPEN
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list