commit - d4940d40064a4fd732c26af1bb551d1ff633852d
commit + ae30b714638faafc5075b3a69696149f4a129630
blob - 34c1b6df1b13b23dea3ca12f6a6cdaf82e3106f4
blob + 9d11c8f4f518f5f911295671d3aafcb494a7ec10
--- include/got_object.h
+++ include/got_object.h
*/
const struct got_error *got_object_blob_is_binary(int *,
struct got_blob_object *);
+
+/*
+ * getline(3) for blobs.
+ */
+const struct got_error *got_object_blob_getline(char **, ssize_t *,
+ size_t *, struct got_blob_object *);
/*
* Read the entire content of a blob and write it to the specified file.
blob - 39dc38ff83605b0979a15bb8674a2ba1cd65016f
blob + e01e3ce52410a3b3ab1d17c77e8c05011ee01183
--- lib/object.c
+++ lib/object.c
if (fseeko(blob->f, hdrlen, SEEK_SET) == -1)
return got_error_from_errno("fseeko");
+ return NULL;
+}
+
+const struct got_error *
+got_object_blob_getline(char **line, ssize_t *linelen, size_t *linesize,
+ struct got_blob_object *blob)
+{
+ *linelen = getline(line, linesize, blob->f);
+ if (*linelen == -1 && !feof(blob->f))
+ return got_error_from_errno("getline");
return NULL;
}