Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH 06/12] add range clone functions

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:49:01

Bo Yang [off-list ref] writes:
quoted hunk
Both single range clone and deeply clone are supported.

Signed-off-by: Bo Yang <redacted>
---
 line.c |   35 +++++++++++++++++++++++++++++++++++
 line.h |    4 ++++
 2 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/line.c b/line.c
index 7b7f3f3..f765a03 100644
--- a/line.c
+++ b/line.c
@@ -370,6 +370,41 @@ void diff_line_range_append(struct diff_line_range *r, const char *arg)
 	r->ranges[r->nr - 1].arg = arg;
 }
 
+struct diff_line_range *diff_line_range_clone(struct diff_line_range *r)
+{
+	struct diff_line_range *ret = xmalloc(sizeof(*ret));
+
+	DIFF_LINE_RANGE_INIT(ret);
+	ret->ranges = xcalloc(sizeof(struct range), r->nr);
Please don't break the calloc(nmemb, size-of-one-member) convention.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help