History

msg: split mp_msg_flush_status_line into private and public variant

Kacper Michajłow committed 2 years ago

Commit 895dd9e1 parent 243c1d61 file · +17 −12Browse files

Unified · Split

common/msg.c+17−12
@@ -246,34 +246,39 @@ static void prepare_prefix(struct mp_log_root *root, bstr *out, int lev, int ter · 245 unmodified lines
246246 root->blank_lines += root->status_lines;
247247 }
248248
249−void mp_msg_flush_status_line(struct mp_log *log, bool clear)
249+static void msg_flush_status_line(struct mp_log_root *root, bool clear)
250250 {
251− if (!log->root)
252− return;
253−
254− mp_mutex_lock(&log->root->lock);
255− if (!log->root->status_lines)
251+ if (!root->status_lines)
256252 goto done;
257253
258− FILE *fp = term_msg_fp(log->root, MSGL_STATUS);
254+ FILE *fp = term_msg_fp(root, MSGL_STATUS);
259255 if (!clear) {
260− if (log->root->isatty[term_msg_fileno(log->root, MSGL_STATUS)])
256+ if (root->isatty[term_msg_fileno(root, MSGL_STATUS)])
261257 fprintf(fp, TERM_ESC_RESTORE_CURSOR);
262258 fprintf(fp, "\n");
263− log->root->blank_lines = 0;
264− log->root->status_lines = 0;
259+ root->blank_lines = 0;
260+ root->status_lines = 0;
265261 goto done;
266262 }
267263
268264 bstr term_msg = {0};
269− prepare_prefix(log->root, &term_msg, MSGL_STATUS, 0);
265+ prepare_prefix(root, &term_msg, MSGL_STATUS, 0);
270266 if (term_msg.len) {
271267 fprintf(fp, "%.*s", BSTR_P(term_msg));
272268 talloc_free(term_msg.start);
273269 }
274270
275271 done:
276− log->root->status_line.len = 0;
272+ root->status_line.len = 0;
273+}
274+
275+void mp_msg_flush_status_line(struct mp_log *log, bool clear)
276+{
277+ if (!log->root)
278+ return;
279+
280+ mp_mutex_lock(&log->root->lock);
281+ msg_flush_status_line(log->root, clear);
277282 mp_mutex_unlock(&log->root->lock);
278283 }
279284

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t