[PATCH] blame: avoid -lm by not using log().

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

 



... as suggested on the list.

Signed-off-by: Junio C Hamano <junkio@xxxxxxx>

---

 Makefile |    4 ----
 blame.c  |    6 ++++--
 2 files changed, 4 insertions(+), 6 deletions(-)

e0539773df17e5f8410850b8ffcfe8d2fa14ab7a
diff --git a/Makefile b/Makefile
index eb1887d..b6d8804 100644
--- a/Makefile
+++ b/Makefile
@@ -534,10 +534,6 @@ git-rev-list$X: rev-list.o $(LIB_FILE)
 	$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(LIBS) $(OPENSSL_LIBSSL)
 
-git-blame$X: blame.o $(LIB_FILE)
-	$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
-		$(LIBS) -lm
-
 init-db.o: init-db.c
 	$(CC) -c $(ALL_CFLAGS) \
 		-DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"' $*.c
diff --git a/blame.c b/blame.c
index 168b1f5..59146fa 100644
--- a/blame.c
+++ b/blame.c
@@ -589,7 +589,7 @@ int main(int argc, const char **argv)
 				usage(blame_usage);
 			else if(!strcmp(argv[i], "-l") ||
 				!strcmp(argv[i], "--long")) {
-				sha1_len = 20;
+				sha1_len = 40;
 				continue;
 			} else if(!strcmp(argv[i], "-c") ||
 				  !strcmp(argv[i], "--compability")) {
@@ -651,7 +651,9 @@ int main(int argc, const char **argv)
 	process_commits(&rev, filename, &initial);
 
 	buf = blame_contents;
-	max_digits = 1 + log(num_blame_lines+1)/log(10);
+	for (max_digits = 1, i = 10; i <= num_blame_lines; max_digits++)
+		i *= 10;
+
 	for (i = 0; i < num_blame_lines; i++) {
 		struct commit *c = blame_lines[i];
 		if (!c)
-- 
1.2.4.gee5c7


-
: 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]