[PATCH v3 1/3] commit-tree: use prefixcmp instead of memcmp(..., N)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Handrolling the prefix comparison is harder to read and overruns if
the argument is an empty string.  Use our prefixcmp() instead.

Signed-off-by: Thomas Rast <tr@xxxxxxxxxxxxx>
---
 builtin/commit-tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c
index f641ff2..19d58f9 100644
--- a/builtin/commit-tree.c
+++ b/builtin/commit-tree.c
@@ -61,7 +61,7 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)
 			continue;
 		}
 
-		if (!memcmp(arg, "-S", 2)) {
+		if (!prefixcmp(arg, "-S")) {
 			sign_commit = arg + 2;
 			continue;
 		}
-- 
1.8.5.rc2.348.gb73b695

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]