Re: [PATCH 11/19] tree-diff: simplify tree_entry_pathcmp
On Mon, Mar 24, 2014 at 02:25:04PM -0700, Junio C Hamano wrote: Kirill Smelkov k...@mns.spb.ru writes: Since an earlier Finally switch over tree descriptors to contain a pre-parsed entry, we can safely access all tree_desc-entry fields directly instead of first extracting them through tree_entry_extract. Use it. The code generated stays the same - only it now visually looks cleaner. Signed-off-by: Kirill Smelkov k...@mns.spb.ru Signed-off-by: Junio C Hamano gits...@pobox.com --- ( re-posting without change ) Thanks. Hopefully I'll be merging the series up to this point to 'next' soonish. Thanks a lot! tree-diff.c | 17 ++--- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/tree-diff.c b/tree-diff.c index 20a4fda..cf96ad7 100644 --- a/tree-diff.c +++ b/tree-diff.c @@ -15,18 +15,13 @@ */ static int tree_entry_pathcmp(struct tree_desc *t1, struct tree_desc *t2) { - unsigned mode1, mode2; - const char *path1, *path2; - const unsigned char *sha1, *sha2; - int cmp, pathlen1, pathlen2; + struct name_entry *e1, *e2; + int cmp; - sha1 = tree_entry_extract(t1, path1, mode1); - sha2 = tree_entry_extract(t2, path2, mode2); - - pathlen1 = tree_entry_len(t1-entry); - pathlen2 = tree_entry_len(t2-entry); - - cmp = base_name_compare(path1, pathlen1, mode1, path2, pathlen2, mode2); + e1 = t1-entry; + e2 = t2-entry; + cmp = base_name_compare(e1-path, tree_entry_len(e1), e1-mode, + e2-path, tree_entry_len(e2), e2-mode); return cmp; } -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 11/19] tree-diff: simplify tree_entry_pathcmp
Kirill Smelkov k...@mns.spb.ru writes: Since an earlier Finally switch over tree descriptors to contain a pre-parsed entry, we can safely access all tree_desc-entry fields directly instead of first extracting them through tree_entry_extract. Use it. The code generated stays the same - only it now visually looks cleaner. Signed-off-by: Kirill Smelkov k...@mns.spb.ru Signed-off-by: Junio C Hamano gits...@pobox.com --- ( re-posting without change ) Thanks. Hopefully I'll be merging the series up to this point to 'next' soonish. tree-diff.c | 17 ++--- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/tree-diff.c b/tree-diff.c index 20a4fda..cf96ad7 100644 --- a/tree-diff.c +++ b/tree-diff.c @@ -15,18 +15,13 @@ */ static int tree_entry_pathcmp(struct tree_desc *t1, struct tree_desc *t2) { - unsigned mode1, mode2; - const char *path1, *path2; - const unsigned char *sha1, *sha2; - int cmp, pathlen1, pathlen2; + struct name_entry *e1, *e2; + int cmp; - sha1 = tree_entry_extract(t1, path1, mode1); - sha2 = tree_entry_extract(t2, path2, mode2); - - pathlen1 = tree_entry_len(t1-entry); - pathlen2 = tree_entry_len(t2-entry); - - cmp = base_name_compare(path1, pathlen1, mode1, path2, pathlen2, mode2); + e1 = t1-entry; + e2 = t2-entry; + cmp = base_name_compare(e1-path, tree_entry_len(e1), e1-mode, + e2-path, tree_entry_len(e2), e2-mode); return cmp; } -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 11/19] tree-diff: simplify tree_entry_pathcmp
Since an earlier Finally switch over tree descriptors to contain a pre-parsed entry, we can safely access all tree_desc-entry fields directly instead of first extracting them through tree_entry_extract. Use it. The code generated stays the same - only it now visually looks cleaner. Signed-off-by: Kirill Smelkov k...@mns.spb.ru Signed-off-by: Junio C Hamano gits...@pobox.com --- ( re-posting without change ) tree-diff.c | 17 ++--- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/tree-diff.c b/tree-diff.c index 20a4fda..cf96ad7 100644 --- a/tree-diff.c +++ b/tree-diff.c @@ -15,18 +15,13 @@ */ static int tree_entry_pathcmp(struct tree_desc *t1, struct tree_desc *t2) { - unsigned mode1, mode2; - const char *path1, *path2; - const unsigned char *sha1, *sha2; - int cmp, pathlen1, pathlen2; + struct name_entry *e1, *e2; + int cmp; - sha1 = tree_entry_extract(t1, path1, mode1); - sha2 = tree_entry_extract(t2, path2, mode2); - - pathlen1 = tree_entry_len(t1-entry); - pathlen2 = tree_entry_len(t2-entry); - - cmp = base_name_compare(path1, pathlen1, mode1, path2, pathlen2, mode2); + e1 = t1-entry; + e2 = t2-entry; + cmp = base_name_compare(e1-path, tree_entry_len(e1), e1-mode, + e2-path, tree_entry_len(e2), e2-mode); return cmp; } -- 1.9.rc1.181.g641f458 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html