logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git

0002-Use-memset-to-initialize-large-structures.patch (1730B)


  1. From d7c460e5ccc89d30165decb7579486d5bcc26ba4 Mon Sep 17 00:00:00 2001
  2. From: Michael Forney <mforney@mforney.org>
  3. Date: Tue, 2 Jul 2019 17:41:43 -0700
  4. Subject: [PATCH] Use memset to initialize large structures
  5. These are over 256 KiB in size.
  6. ---
  7. video/out/gpu/video.c | 17 ++++++++---------
  8. 1 file changed, 8 insertions(+), 9 deletions(-)
  9. diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c
  10. index 1478ec4687..49101b3f0d 100644
  11. --- a/video/out/gpu/video.c
  12. +++ b/video/out/gpu/video.c
  13. @@ -3630,7 +3630,7 @@ static void frame_perf_data(struct pass_info pass[], struct mp_frame_perf *out)
  14. void gl_video_perfdata(struct gl_video *p, struct voctrl_performance_data *out)
  15. {
  16. - *out = (struct voctrl_performance_data){0};
  17. + memset(out, 0, sizeof(*out));
  18. frame_perf_data(p->pass_fresh, &out->fresh);
  19. frame_perf_data(p->pass_redraw, &out->redraw);
  20. }
  21. @@ -4074,14 +4074,13 @@ struct gl_video *gl_video_init(struct ra *ra, struct mp_log *log,
  22. struct mpv_global *g)
  23. {
  24. struct gl_video *p = talloc_ptrtype(NULL, p);
  25. - *p = (struct gl_video) {
  26. - .ra = ra,
  27. - .global = g,
  28. - .log = log,
  29. - .sc = gl_sc_create(ra, g, log),
  30. - .video_eq = mp_csp_equalizer_create(p, g),
  31. - .opts_cache = m_config_cache_alloc(p, g, &gl_video_conf),
  32. - };
  33. + memset(p, 0, sizeof(*p));
  34. + p->ra = ra;
  35. + p->global = g;
  36. + p->log = log;
  37. + p->sc = gl_sc_create(ra, g, log);
  38. + p->video_eq = mp_csp_equalizer_create(p, g);
  39. + p->opts_cache = m_config_cache_alloc(p, g, &gl_video_conf);
  40. // make sure this variable is initialized to *something*
  41. p->pass = p->pass_fresh;
  42. struct gl_video_opts *opts = p->opts_cache->opts;
  43. --
  44. 2.44.0