]> git.ipfire.org Git - thirdparty/git.git/commitdiff
thread-utils.h: simplify the inclusion
authorJunio C Hamano <gitster@pobox.com>
Fri, 10 Dec 2010 18:32:12 +0000 (10:32 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 10 Dec 2010 20:58:06 +0000 (12:58 -0800)
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: Junio C Hamano <gitster@pobox.com>
builtin/grep.c
builtin/pack-objects.c
thread-utils.h
transport-helper.c

index adb542494dde32123011b1e76ed164ab39e6e716..fdf7131efd25618250f382dff178ca38f9b42c77 100644 (file)
 #include "grep.h"
 #include "quote.h"
 #include "dir.h"
-
-#ifndef NO_PTHREADS
-#include <pthread.h>
 #include "thread-utils.h"
-#endif
 
 static char const * const grep_usage[] = {
        "git grep [options] [-e] <pattern> [<rev>...] [[--] <path>...]",
index f027b3abb4093e0382b3e612f03b634cee2c6b1d..b0503b202afb4356caaca794518fb4e21082a48f 100644 (file)
 #include "list-objects.h"
 #include "progress.h"
 #include "refs.h"
-
-#ifndef NO_PTHREADS
-#include <pthread.h>
 #include "thread-utils.h"
-#endif
 
 static const char pack_usage[] =
   "git pack-objects [ -q | --progress | --all-progress ]\n"
index 1727a03333b80f2a01ca029162a4b511480a86e8..6fb98c333c22a67512516bbf047c2cac270a66ae 100644 (file)
@@ -1,7 +1,11 @@
 #ifndef THREAD_COMPAT_H
 #define THREAD_COMPAT_H
 
+#ifndef NO_PTHREADS
+#include <pthread.h>
+
 extern int online_cpus(void);
 extern int init_recursive_mutex(pthread_mutex_t*);
 
+#endif
 #endif /* THREAD_COMPAT_H */
index 3a50856318798c14824bb628d7d463cd61b77213..4e4754c32bd53f28f9335c2a4529f5804f3086f2 100644 (file)
@@ -8,11 +8,7 @@
 #include "quote.h"
 #include "remote.h"
 #include "string-list.h"
-
-#ifndef NO_PTHREADS
-#include <pthread.h>
 #include "thread-utils.h"
-#endif
 
 static int debug;