summaryrefslogtreecommitdiff
path: root/file
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-29 01:51:28 (GMT)
committerWerner Almesberger <werner@almesberger.net>2016-08-29 01:51:28 (GMT)
commitf06dcc85cf74173560579c42d7de23b10aa8d99a (patch)
tree224a64a02355cc4844807239697864ba411983a7 /file
parentd8a29b6d945f75e2f081a71f4da1b9f361eae9cf (diff)
downloadeeshow-f06dcc85cf74173560579c42d7de23b10aa8d99a.zip
eeshow-f06dcc85cf74173560579c42d7de23b10aa8d99a.tar.gz
eeshow-f06dcc85cf74173560579c42d7de23b10aa8d99a.tar.bz2
file/git-hist.c (classify_threads): rename to threads_classify; split off size
We may prefer to know the number of threads before starting to walk down the list.
Diffstat (limited to 'file')
-rw-r--r--file/git-hist.c15
-rw-r--r--file/git-hist.h5
2 files changed, 13 insertions, 7 deletions
diff --git a/file/git-hist.c b/file/git-hist.c
index 2e437bb..113f3c5 100644
--- a/file/git-hist.c
+++ b/file/git-hist.c
@@ -593,15 +593,19 @@ static unsigned assign_threads(struct vcs_history *history)
/* ----- Thread vector ----------------------------------------------------- */
+unsigned threads_number(const struct vcs_history *history)
+{
+ return history->max_threads;
+}
+
-enum thread *classify_threads(const struct vcs_history *history,
- const struct vcs_hist *h, const struct vcs_hist *next, unsigned *n)
+enum thread *threads_classify(const struct vcs_history *history,
+ const struct vcs_hist *h, const struct vcs_hist *next)
{
enum thread *t;
unsigned i, j;
- *n = history->max_threads;
- t = alloc_type_n(enum thread, *n);
+ t = alloc_type_n(enum thread, history->max_threads);
for (i = 0; i != history->max_threads; i++)
t[i] = thread_none;
for (i = 0; i != h->n_threads; i++)
@@ -689,7 +693,8 @@ for (i = 0; i != h->n_threads; i++)
fprintf(stderr, " %p", h->threads[i]);
fprintf(stderr, " (%p)\n", next);
#endif
- t = classify_threads(history, h, next, &n);
+ n = threads_number(history);
+ t = threads_classify(history, h, next);
#ifdef DUMP
for (i = 0; i != n; i++)
fprintf(stderr, "%d ", t[i]);
diff --git a/file/git-hist.h b/file/git-hist.h
index d48f013..d93907b 100644
--- a/file/git-hist.h
+++ b/file/git-hist.h
@@ -62,8 +62,9 @@ char *vcs_git_summary_for_pango(struct vcs_hist *hist,
char *vcs_git_long_for_pango(struct vcs_hist *hist,
char *(*formatter)(const char *fmt, ...));
-enum thread *classify_threads(const struct vcs_history *history,
- const struct vcs_hist *h, const struct vcs_hist *next, unsigned *n);
+unsigned threads_number(const struct vcs_history *history);
+enum thread *threads_classify(const struct vcs_history *history,
+ const struct vcs_hist *h, const struct vcs_hist *next);
void hist_iterate(struct vcs_history *history,
void (*fn)(void *user, struct vcs_hist *h), void *user);