Skip to content

Commit 92324d8

Browse files
committed
util: clean up header includes
While "util.h" declares the macro `git__tolower`, which simply resorts to tolower(3P) on Unix-like systems, the <ctype.h> header is only being included in "util.c". Thus, anybody who has included "util.h" without having <ctype.h> included will fail to compile as soon as the macro is in use. Furthermore, we can clean up additional includes in "util.c" and simply replace them with an include for "common.h".
1 parent 06b8a40 commit 92324d8

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/util.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77

88
#include "util.h"
99

10-
#include "git2.h"
11-
#include <stdio.h>
12-
#include <ctype.h>
13-
#include "posix.h"
10+
#include "common.h"
1411

1512
#ifdef GIT_WIN32
1613
# include "win32/w32_buffer.h"

src/util.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,16 @@
99

1010
#include "common.h"
1111

12+
#ifndef GIT_WIN32
13+
# include <ctype.h>
14+
#endif
15+
1216
#include "git2/buffer.h"
13-
#include "buffer.h"
14-
#include "thread-utils.h"
1517

18+
#include "buffer.h"
1619
#include "common.h"
1720
#include "strnlen.h"
21+
#include "thread-utils.h"
1822

1923
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
2024
#define bitsizeof(x) (CHAR_BIT * sizeof(x))

0 commit comments

Comments
 (0)