提交 b361888d 编写于 作者: J Junio C Hamano

thread-utils.h: simplify the inclusion

All files that include this header file use the same four line
incantation:

    #ifndef NO_PTHREADS
    #include <pthread.h>
    #include "thread-utils.h"
    #endif

Move the responsibility for that gymnastics to the header file from the
files that include it.  This approach makes it easier to later declare new
services that are related to threading in thread-utils.h and have them
available to all the threading code.
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 e4117b1f
...@@ -17,11 +17,7 @@ ...@@ -17,11 +17,7 @@
#include "grep.h" #include "grep.h"
#include "quote.h" #include "quote.h"
#include "dir.h" #include "dir.h"
#ifndef NO_PTHREADS
#include <pthread.h>
#include "thread-utils.h" #include "thread-utils.h"
#endif
static char const * const grep_usage[] = { static char const * const grep_usage[] = {
"git grep [options] [-e] <pattern> [<rev>...] [[--] <path>...]", "git grep [options] [-e] <pattern> [<rev>...] [[--] <path>...]",
......
...@@ -16,11 +16,7 @@ ...@@ -16,11 +16,7 @@
#include "list-objects.h" #include "list-objects.h"
#include "progress.h" #include "progress.h"
#include "refs.h" #include "refs.h"
#ifndef NO_PTHREADS
#include <pthread.h>
#include "thread-utils.h" #include "thread-utils.h"
#endif
static const char pack_usage[] = static const char pack_usage[] =
"git pack-objects [ -q | --progress | --all-progress ]\n" "git pack-objects [ -q | --progress | --all-progress ]\n"
......
#ifndef THREAD_COMPAT_H #ifndef THREAD_COMPAT_H
#define THREAD_COMPAT_H #define THREAD_COMPAT_H
#ifndef NO_PTHREADS
#include <pthread.h>
extern int online_cpus(void); extern int online_cpus(void);
extern int init_recursive_mutex(pthread_mutex_t*); extern int init_recursive_mutex(pthread_mutex_t*);
#endif
#endif /* THREAD_COMPAT_H */ #endif /* THREAD_COMPAT_H */
...@@ -8,11 +8,7 @@ ...@@ -8,11 +8,7 @@
#include "quote.h" #include "quote.h"
#include "remote.h" #include "remote.h"
#include "string-list.h" #include "string-list.h"
#ifndef NO_PTHREADS
#include <pthread.h>
#include "thread-utils.h" #include "thread-utils.h"
#endif
static int debug; static int debug;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册