summaryrefslogtreecommitdiff
path: root/dynstr.c
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2010-10-25 10:37:32 +0100
committerLars Wirzenius <liw@liw.fi>2010-10-25 10:37:32 +0100
commited77916173766327248d84453564f1ae05b05535 (patch)
treeadb0e4c58330deae014897fca913fd51b869833b /dynstr.c
parent20da8374e9da7009da7fe7cfbf81387f6cc94dc6 (diff)
downloaddynstr-ed77916173766327248d84453564f1ae05b05535.tar.gz
Implement dynstr_write.
Changed the function signature since write(2) is so different from fwrite(3), and there's no point in trying to shoehorn the two into the same mold.
Diffstat (limited to 'dynstr.c')
-rw-r--r--dynstr.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/dynstr.c b/dynstr.c
index 4805b45..99ef2ab 100644
--- a/dynstr.c
+++ b/dynstr.c
@@ -4,6 +4,7 @@
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include "dynstr.h"
@@ -294,3 +295,9 @@ size_t dynstr_fwrite(FILE *file, Dynstr *dynstr)
return fwrite(dynstr->mem, 1, dynstr->size, file);
}
+
+ssize_t dynstr_write(int fd, Dynstr *dynstr)
+{
+ return write(fd, dynstr->mem, dynstr->size);
+}
+