Commit Diff


commit - 1b5d300f3ff325202e42e0a05b1f23f1d8b8e839
commit + ae012d47ffe30ad1e3d00cbca2485f2c10a0f558
blob - 7c2bfddb8f77a9026ec782026f3775a07e004f5e
blob + 6855889d9612f734106a574e7b7ff947b56823d5
--- lib/diff_internal.h
+++ lib/diff_internal.h
@@ -96,30 +96,6 @@ struct diff_chunk {
 
 #define DIFF_RESULT_ALLOC_BLOCKSIZE 128
 
-enum diff_chunk_type {
-	CHUNK_EMPTY,
-	CHUNK_PLUS,
-	CHUNK_MINUS,
-	CHUNK_SAME,
-	CHUNK_ERROR,
-};
-
-static inline enum diff_chunk_type
-diff_chunk_type(const struct diff_chunk *chunk)
-{
-	if (!chunk->left_count && !chunk->right_count)
-		return CHUNK_EMPTY;
-	if (!chunk->solved)
-		return CHUNK_ERROR;
-	if (!chunk->right_count)
-		return CHUNK_MINUS;
-	if (!chunk->left_count)
-		return CHUNK_PLUS;
-	if (chunk->left_count != chunk->right_count)
-		return CHUNK_ERROR;
-	return CHUNK_SAME;
-}
-
 struct diff_chunk_context;
 
 bool
blob - 3196ebae01117f7b1caa9b36f55c780ee0c460e5
blob + 1ed410a61ad2708a8a3069153391f0f52560122a
--- lib/diff_main.c
+++ lib/diff_main.c
@@ -36,6 +36,22 @@
 
 #include "diff_internal.h"
 #include "diff_debug.h"
+
+inline enum diff_chunk_type
+diff_chunk_type(const struct diff_chunk *chunk)
+{
+	if (!chunk->left_count && !chunk->right_count)
+		return CHUNK_EMPTY;
+	if (!chunk->solved)
+		return CHUNK_ERROR;
+	if (!chunk->right_count)
+		return CHUNK_MINUS;
+	if (!chunk->left_count)
+		return CHUNK_PLUS;
+	if (chunk->left_count != chunk->right_count)
+		return CHUNK_ERROR;
+	return CHUNK_SAME;
+}
 
 static int
 read_at(FILE *f, off_t at_pos, unsigned char *buf, size_t len)
blob - fa9dc982956eab298f65b4b9ffca114a46b50b76
blob + 04a6c6e748c995f16f8d1d2d4dc36c1b9f65abdc
--- lib/diff_main.h
+++ lib/diff_main.h
@@ -28,8 +28,8 @@ struct diff_range {
 struct diff_atom {
 	struct diff_data *root; /* back pointer to root diff data */
 
-	off_t pos;		/* if not memory-mapped */
-	const uint8_t *at;	/* if memory-mapped */
+	off_t pos;		/* set whether memory-mapped or not */
+	const uint8_t *at;	/* only set if memory-mapped */
 	off_t len;
 
 	/* This hash is just a very cheap speed up for finding *mismatching*
@@ -140,8 +140,18 @@ struct diff_result {
 	struct diff_data *right;
 
 	diff_chunk_arraylist_t chunks;
+};
+
+enum diff_chunk_type {
+	CHUNK_EMPTY,
+	CHUNK_PLUS,
+	CHUNK_MINUS,
+	CHUNK_SAME,
+	CHUNK_ERROR,
 };
 
+enum diff_chunk_type diff_chunk_type(const struct diff_chunk *c);
+
 struct diff_state;
 
 /* Signature of a utility function to divide a file into diff atoms.