Code

builtin/grep: make lock/unlock into static inline functions
[git.git] / builtin / grep.c
index 024b87868aaf6b57b4af01feecf671cad664433c..3ddfae4e79b5092a211608f25b6ded9b522d9f99 100644 (file)
@@ -74,13 +74,32 @@ static int all_work_added;
 /* This lock protects all the variables above. */
 static pthread_mutex_t grep_mutex;
 
+static inline void grep_lock(void)
+{
+       if (use_threads)
+               pthread_mutex_lock(&grep_mutex);
+}
+
+static inline void grep_unlock(void)
+{
+       if (use_threads)
+               pthread_mutex_unlock(&grep_mutex);
+}
+
 /* Used to serialize calls to read_sha1_file. */
 static pthread_mutex_t read_sha1_mutex;
 
-#define grep_lock() pthread_mutex_lock(&grep_mutex)
-#define grep_unlock() pthread_mutex_unlock(&grep_mutex)
-#define read_sha1_lock() pthread_mutex_lock(&read_sha1_mutex)
-#define read_sha1_unlock() pthread_mutex_unlock(&read_sha1_mutex)
+static inline void read_sha1_lock(void)
+{
+       if (use_threads)
+               pthread_mutex_lock(&read_sha1_mutex);
+}
+
+static inline void read_sha1_unlock(void)
+{
+       if (use_threads)
+               pthread_mutex_unlock(&read_sha1_mutex);
+}
 
 /* Signalled when a new work_item is added to todo. */
 static pthread_cond_t cond_add;
@@ -1064,7 +1083,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
                        die(_("--no-index or --untracked cannot be used with revs."));
                hit = grep_directory(&opt, &pathspec, use_exclude);
        } else if (0 <= opt_exclude) {
-               die(_("--exclude or --no-exclude cannot be used for tracked contents."));
+               die(_("--[no-]exclude-standard cannot be used for tracked contents."));
        } else if (!list.nr) {
                if (!cached)
                        setup_work_tree();