[libgit2-glib] Make get_content return a byte array
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgit2-glib] Make get_content return a byte array
- Date: Sat, 23 Nov 2013 14:11:47 +0000 (UTC)
commit 944532a4311206b6763673db133e263f142f9614
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Sat Nov 23 14:56:17 2013 +0100
Make get_content return a byte array
libgit2-glib/ggit-diff-line.c | 33 ++++++++++++---------------------
1 files changed, 12 insertions(+), 21 deletions(-)
---
diff --git a/libgit2-glib/ggit-diff-line.c b/libgit2-glib/ggit-diff-line.c
index 4d1a453..f135856 100644
--- a/libgit2-glib/ggit-diff-line.c
+++ b/libgit2-glib/ggit-diff-line.c
@@ -144,22 +144,6 @@ ggit_diff_line_get_new_lineno (GgitDiffLine *line)
}
/**
- * ggit_diff_line_get_content_len:
- * @line: a #GgitDiffLine.
- *
- * Gets the content length.
- *
- * Returns: the content length.
- */
-gsize
-ggit_diff_line_get_content_len (GgitDiffLine *line)
-{
- g_return_val_if_fail (line != NULL, 0);
-
- return line->content_len;
-}
-
-/**
* ggit_diff_line_get_content_offset:
* @line: a #GgitDiffLine.
*
@@ -178,17 +162,24 @@ ggit_diff_line_get_content_offset (GgitDiffLine *line)
/**
* ggit_diff_line_get_content:
* @line: a #GgitDiffLine.
+ * @length: (out): the number of returned bytes.
*
- * Gets the content.
+ * Gets the content in bytes.
*
- * Returns: the content.
+ * Returns: (array length=length): the content in bytes.
*/
-const gchar *
-ggit_diff_line_get_content (GgitDiffLine *line)
+const guint8 *
+ggit_diff_line_get_content (GgitDiffLine *line,
+ gsize *length)
{
g_return_val_if_fail (line != NULL, 0);
- return line->content;
+ if (length)
+ {
+ *length = line->content_len;
+ }
+
+ return (const guint8 *)line->content;
}
/* ex:set ts=8 noet: */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]