summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Johannes Sixt <j6t@kdbg.org>2015-06-05 21:45:05 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-06-05 15:00:32 -0700
commit2024d3176536fd437b4c0a744161e96bc150a24e (patch)
treef1eae651d898a045d48cf6ecac60f22f4dff1cd4
parentlockfile: replace random() by rand() (diff)
downloadtgif-2024d3176536fd437b4c0a744161e96bc150a24e.tar.xz
help.c: wrap wait-only poll() invocation in sleep_millisec()
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>
-rw-r--r--cache.h1
-rw-r--r--help.c2
-rw-r--r--wrapper.c5
3 files changed, 7 insertions, 1 deletions
diff --git a/cache.h b/cache.h
index 54f108a28f..328cdb73ee 100644
--- 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 2072a873e2..de1279b422 100644
--- 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;
}
diff --git a/wrapper.c b/wrapper.c
index c1a663fd59..ff49807948 100644
--- 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);
+}