From: Junio C Hamano Date: Fri, 10 Dec 2010 18:32:12 +0000 (-0800) Subject: thread-utils.h: simplify the inclusion X-Git-Tag: v1.7.4-rc0~68 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b361888dd5a26c4f1eb6268392e89e2d546accf6;p=git.git thread-utils.h: simplify the inclusion All files that include this header file use the same four line incantation: #ifndef NO_PTHREADS #include #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: Junio C Hamano --- diff --git a/builtin/grep.c b/builtin/grep.c index adb542494..fdf7131ef 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -17,11 +17,7 @@ #include "grep.h" #include "quote.h" #include "dir.h" - -#ifndef NO_PTHREADS -#include #include "thread-utils.h" -#endif static char const * const grep_usage[] = { "git grep [options] [-e] [...] [[--] ...]", diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index f027b3abb..b0503b202 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -16,11 +16,7 @@ #include "list-objects.h" #include "progress.h" #include "refs.h" - -#ifndef NO_PTHREADS -#include #include "thread-utils.h" -#endif static const char pack_usage[] = "git pack-objects [ -q | --progress | --all-progress ]\n" diff --git a/thread-utils.h b/thread-utils.h index 1727a0333..6fb98c333 100644 --- a/thread-utils.h +++ b/thread-utils.h @@ -1,7 +1,11 @@ #ifndef THREAD_COMPAT_H #define THREAD_COMPAT_H +#ifndef NO_PTHREADS +#include + extern int online_cpus(void); extern int init_recursive_mutex(pthread_mutex_t*); +#endif #endif /* THREAD_COMPAT_H */ diff --git a/transport-helper.c b/transport-helper.c index 3a5085631..4e4754c32 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -8,11 +8,7 @@ #include "quote.h" #include "remote.h" #include "string-list.h" - -#ifndef NO_PTHREADS -#include #include "thread-utils.h" -#endif static int debug;