mirror of https://github.com/mpv-player/mpv
various: remove ATOMIC_VAR_INIT
the fallback needed it due to the struct wrapper. but the fallback is now removed so it's no longer needed. as for standard atomics, it was never really needed either, was useless and then made obsolete in C17 and removed in C23. ref: https://gustedt.wordpress.com/2018/08/06/c17-obsoletes-atomic_var_init/ ref: https://en.cppreference.com/w/c/atomic/ATOMIC_VAR_INIT
This commit is contained in:
parent
2070331f64
commit
450a69b1d6
|
@ -524,7 +524,7 @@ void mp_msg_init(struct mpv_global *global)
|
|||
struct mp_log_root *root = talloc_zero(NULL, struct mp_log_root);
|
||||
*root = (struct mp_log_root){
|
||||
.global = global,
|
||||
.reload_counter = ATOMIC_VAR_INIT(1),
|
||||
.reload_counter = 1,
|
||||
};
|
||||
|
||||
pthread_mutex_init(&root->lock, NULL);
|
||||
|
|
|
@ -73,7 +73,7 @@ struct mp_async_queue *mp_async_queue_create(void)
|
|||
struct mp_async_queue *r = talloc_zero(NULL, struct mp_async_queue);
|
||||
r->q = talloc_zero(NULL, struct async_queue);
|
||||
*r->q = (struct async_queue){
|
||||
.refcount = ATOMIC_VAR_INIT(1),
|
||||
.refcount = 1,
|
||||
};
|
||||
pthread_mutex_init(&r->q->lock, NULL);
|
||||
talloc_set_destructor(r, on_free_queue);
|
||||
|
|
|
@ -126,7 +126,7 @@ struct mp_cancel *mp_cancel_new(void *talloc_ctx)
|
|||
struct mp_cancel *c = talloc_ptrtype(talloc_ctx, c);
|
||||
talloc_set_destructor(c, cancel_destroy);
|
||||
*c = (struct mp_cancel){
|
||||
.triggered = ATOMIC_VAR_INIT(false),
|
||||
.triggered = false,
|
||||
.wakeup_pipe = {-1, -1},
|
||||
};
|
||||
pthread_mutex_init(&c->lock, NULL);
|
||||
|
|
|
@ -164,7 +164,7 @@ char *mp_HRESULT_to_str_buf(char *buf, size_t buf_size, HRESULT hr)
|
|||
bool mp_w32_create_anon_pipe(HANDLE *server, HANDLE *client,
|
||||
struct w32_create_anon_pipe_opts *opts)
|
||||
{
|
||||
static atomic_ulong counter = ATOMIC_VAR_INIT(0);
|
||||
static atomic_ulong counter = 0;
|
||||
|
||||
// Generate pipe name
|
||||
unsigned long id = atomic_fetch_add(&counter, 1);
|
||||
|
|
|
@ -126,7 +126,7 @@ struct osd_state *osd_create(struct mpv_global *global)
|
|||
.opts_cache = m_config_cache_alloc(osd, global, &mp_osd_render_sub_opts),
|
||||
.global = global,
|
||||
.log = mp_log_new(osd, global->log, "osd"),
|
||||
.force_video_pts = ATOMIC_VAR_INIT(MP_NOPTS_VALUE),
|
||||
.force_video_pts = MP_NOPTS_VALUE,
|
||||
.stats = stats_ctx_create(osd, global, "osd"),
|
||||
};
|
||||
pthread_mutex_init(&osd->lock, NULL);
|
||||
|
|
|
@ -44,7 +44,7 @@ struct dr_helper *dr_helper_create(struct mp_dispatch_queue *dispatch,
|
|||
talloc_set_destructor(dr, dr_helper_destroy);
|
||||
*dr = (struct dr_helper){
|
||||
.dispatch = dispatch,
|
||||
.dr_in_flight = ATOMIC_VAR_INIT(0),
|
||||
.dr_in_flight = 0,
|
||||
.get_image = get_image,
|
||||
.get_image_ctx = get_image_ctx,
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue