@matheusbsbs / matheus-bagliano / commits / a0fb95e319
Fork 0

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

... as suggested on the list. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Mar 5, 2006 at 14:46 UTC a0fb95e3199810268cfe88c7c4ff0d9958e07062
2 files changed +4 -6
Makefile
-4
@@ -534,10 +534,6 @@ git-rev-list$X: rev-list.o $(LIB_FILE)
534 $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
535 $(LIBS) $(OPENSSL_LIBSSL)
536
537 -git-blame$X: blame.o $(LIB_FILE)
538 - $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
539 - $(LIBS) -lm
540 -
537 init-db.o: init-db.c
538 $(CC) -c $(ALL_CFLAGS) \
539 -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"' $*.c
blame.c
+4 -2
@@ -589,7 +589,7 @@ int main(int argc, const char **argv)
589 usage(blame_usage);
590 else if(!strcmp(argv[i], "-l") ||
591 !strcmp(argv[i], "--long")) {
592 - sha1_len = 20;
592 + sha1_len = 40;
593 continue;
594 } else if(!strcmp(argv[i], "-c") ||
595 !strcmp(argv[i], "--compability")) {
@@ -651,7 +651,9 @@ int main(int argc, const char **argv)
651 process_commits(&rev, filename, &initial);
652
653 buf = blame_contents;
654 - max_digits = 1 + log(num_blame_lines+1)/log(10);
654 + for (max_digits = 1, i = 10; i <= num_blame_lines + 1; max_digits++)
655 + i *= 10;
656 +
657 for (i = 0; i < num_blame_lines; i++) {
658 struct commit *c = blame_lines[i];
659 if (!c)