]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - fd.c
fd: Improve documentation of write_va_buffer().
[paraslash.git] / fd.c
diff --git a/fd.c b/fd.c
index 800106e132b2bc21085f65803d70b6bad492f854..5d23babf38c70e85765931d9ac0c0b0eb4730e37 100644 (file)
--- a/fd.c
+++ b/fd.c
@@ -149,12 +149,20 @@ int write_all(int fd, const char *buf, size_t len)
 }
 
 /**
- * Write a buffer given by a format string.
+ * A fprintf-like function for raw file descriptors.
+ *
+ * This function creates a string buffer according to the given format and
+ * writes this buffer to a file descriptor.
  *
  * \param fd The file descriptor.
  * \param fmt A format string.
  *
+ * The difference to fprintf(3) is that the first argument is a file
+ * descriptor, not a FILE pointer. This function does not rely on stdio.
+ *
  * \return The return value of the underlying call to \ref write_all().
+ *
+ * \sa fprintf(3), \ref xvasprintf().
  */
 __printf_2_3 int write_va_buffer(int fd, const char *fmt, ...)
 {
@@ -269,7 +277,7 @@ int read_nonblock(int fd, void *buf, size_t sz, size_t *num_bytes)
 int read_pattern(int fd, const char *pattern, size_t bufsize)
 {
        size_t n, len;
-       char *buf = para_malloc(bufsize + 1);
+       char *buf = alloc(bufsize + 1);
        int ret = read_nonblock(fd, buf, bufsize, &n);
 
        buf[n] = '\0';