help.c: wrap wait-only poll() invocation in sleep_millisec()
authorJohannes Sixt <j6t@kdbg.org>
Fri, 5 Jun 2015 19:45:05 +0000 (21:45 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 5 Jun 2015 22:00:32 +0000 (15:00 -0700)
We want to use the new function elsewhere in a moment.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cache.h
help.c
wrapper.c
diff --git a/cache.h b/cache.h
index 54f108a28fc0442c7c4c053f5ad2a24c40037bd0..328cdb73ee0a1de33ea7a0add8df6e2890699d39 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -1680,5 +1680,6 @@ int stat_validity_check(struct stat_validity *sv, const char *path);
 void stat_validity_update(struct stat_validity *sv, int fd);
 
 int versioncmp(const char *s1, const char *s2);
+void sleep_millisec(int millisec);
 
 #endif /* CACHE_H */
diff --git a/help.c b/help.c
index 2072a873e2db784ca66c0f1736b12e523a96b7db..de1279b4227c450ad9229aec36ea1ae7b0079410 100644 (file)
--- a/help.c
+++ b/help.c
@@ -372,7 +372,7 @@ const char *help_unknown_cmd(const char *cmd)
                if (autocorrect > 0) {
                        fprintf_ln(stderr, _("in %0.1f seconds automatically..."),
                                (float)autocorrect/10.0);
-                       poll(NULL, 0, autocorrect * 100);
+                       sleep_millisec(autocorrect * 100);
                }
                return assumed;
        }
index c1a663fd592133b3e26314f3d598a8bca8bcceb1..ff49807948f3c406fe73511cec4ef4e2b2df186a 100644 (file)
--- a/wrapper.c
+++ b/wrapper.c
@@ -595,3 +595,8 @@ int write_file(const char *path, int fatal, const char *fmt, ...)
        }
        return 0;
 }
+
+void sleep_millisec(int millisec)
+{
+       poll(NULL, 0, millisec);
+}