git: eea5f8d40860 - main - diff: Sort headers.

From: Dag-Erling Smørgrav <des_at_FreeBSD.org>
Date: Fri, 03 May 2024 15:03:53 UTC
The branch main has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=eea5f8d408604c2f70e068f7806a226fe01fc559

commit eea5f8d408604c2f70e068f7806a226fe01fc559
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2024-05-03 15:03:06 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2024-05-03 15:03:50 +0000

    diff: Sort headers.
    
    MFC after:      1 week
    Sponsored by:   Klara, Inc.
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D45078
---
 usr.bin/diff/diff.c        |  4 ++--
 usr.bin/diff/diffdir.c     |  2 +-
 usr.bin/diff/diffreg_new.c | 10 +++++++---
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/usr.bin/diff/diff.c b/usr.bin/diff/diff.c
index 67aab0de91b5..c3fe255a294d 100644
--- a/usr.bin/diff/diff.c
+++ b/usr.bin/diff/diff.c
@@ -26,11 +26,11 @@
 #include <err.h>
 #include <errno.h>
 #include <getopt.h>
-#include <stdlib.h>
+#include <limits.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <limits.h>
 
 #include "diff.h"
 #include "xmalloc.h"
diff --git a/usr.bin/diff/diffdir.c b/usr.bin/diff/diffdir.c
index 539f537a08c3..8d12e868f90e 100644
--- a/usr.bin/diff/diffdir.c
+++ b/usr.bin/diff/diffdir.c
@@ -26,10 +26,10 @@
 #include <err.h>
 #include <errno.h>
 #include <fnmatch.h>
+#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <limits.h>
 #include <unistd.h>
 
 #include "diff.h"
diff --git a/usr.bin/diff/diffreg_new.c b/usr.bin/diff/diffreg_new.c
index 39b359422f39..3b50dfd5940b 100644
--- a/usr.bin/diff/diffreg_new.c
+++ b/usr.bin/diff/diffreg_new.c
@@ -15,20 +15,22 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#include <sys/types.h>
 #include <sys/capsicum.h>
+#ifndef DIFF_NO_MMAP
 #include <sys/mman.h>
+#endif
 #include <sys/stat.h>
-#include <sys/types.h>
 
 #include <capsicum_helpers.h>
 #include <err.h>
 #include <fcntl.h>
+#include <stdbool.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <stdbool.h>
-#include <time.h>
 #include <string.h>
+#include <time.h>
 #include <unistd.h>
 
 #include "diff.h"
@@ -266,10 +268,12 @@ done:
 	diff_result_free(result);
 	diff_data_free(&left);
 	diff_data_free(&right);
+#ifndef DIFF_NO_MMAP
 	if (str1)
 		munmap(str1, st1.st_size);
 	if (str2)
 		munmap(str2, st2.st_size);
+#endif
 	fclose(f1);
 	fclose(f2);