[libgit2-glib] Bind ggit_oid_is_zero
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgit2-glib] Bind ggit_oid_is_zero
- Date: Tue, 23 Dec 2014 18:03:08 +0000 (UTC)
commit d3c77faece89af0ba70b9bda0bb1967cdee80b05
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Tue Dec 23 18:50:24 2014 +0100
Bind ggit_oid_is_zero
libgit2-glib/ggit-oid.c | 16 ++++++++++++++++
libgit2-glib/ggit-oid.h | 2 ++
2 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/libgit2-glib/ggit-oid.c b/libgit2-glib/ggit-oid.c
index 6bb98e5..29869f8 100644
--- a/libgit2-glib/ggit-oid.c
+++ b/libgit2-glib/ggit-oid.c
@@ -218,4 +218,20 @@ ggit_oid_equal (GgitOId const *a,
return git_oid_cmp (&a->oid, &b->oid) == 0;
}
+/**
+ * ggit_oid_is_zero:
+ * @oid: a #GgitOId.
+ *
+ * Get whether the oid contains only zeros.
+ *
+ * Returns: %TRUE if the oid contains only zeros, %FALSE otherwise.
+ */
+gboolean
+ggit_oid_is_zero (GgitOId const *oid)
+{
+ g_return_val_if_fail (oid != NULL, FALSE);
+
+ return git_oid_iszero (&oid->oid) == 1 ? TRUE : FALSE;
+}
+
/* ex:set ts=8 noet: */
diff --git a/libgit2-glib/ggit-oid.h b/libgit2-glib/ggit-oid.h
index b0195eb..b8e123c 100644
--- a/libgit2-glib/ggit-oid.h
+++ b/libgit2-glib/ggit-oid.h
@@ -54,6 +54,8 @@ guint ggit_oid_hash (GgitOId const *oid);
gboolean ggit_oid_equal (GgitOId const *a,
GgitOId const *b);
+gboolean ggit_oid_is_zero (GgitOId const *oid);
+
G_END_DECLS
#endif /* __GGIT_OID_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]