Skip to content
Snippets Groups Projects

core: revert removed explicit init & add missing init

Merged Lyndon Brown requested to merge jnqnfe/vlc:initrevert into master
All threads resolved!
  • vlc_stream_CustomNew() uses vlc_custom_create() which uses calloc().
  • vlc_stream_CustomNew() additionally initialised most attributes to NULL/0/false (some were missing).
  • Functions using vlc_stream_CustomNew() further such initialised some attributes.

Patches removing the explicit initialisation (because I felt it was redundant) got merged in !1104 (merged) from a last minute addition that got overlooked. A revert of these patches has been requested (see !1104 (merged) discussion).

The basis for reverting is because explicit initialisation is preferred even if redundant. There is a portability issue at play here. The C standard says that an "integral constant expression" of 0 assigned to or compared with a pointer is interpreted as being a null pointer. Thus ptr = 0 means set to a null pointer and ptr == 0 compares with a null pointer, which we often do indirectly via the NULL define, but this does not mean that a null pointer is necessarily a memory address of zero which is up to the underlying platform to decide. A call to calloc() or memset(ptr, 0, n) guarantee that memory is set to zero. Portably, use of those functions cannot be considered to correctly initialise pointers to be null pointers, just as is the same for correctly initialising floats/doubles to a value of 0.0 which is not necessarily an all-zero-bit pattern.

  • The first commit reverts b10f5a02, restoring the (actually redundant) init done by users of vlc_stream_CustomNew().
  • The second commit reverts 830ea36e, restoring the explicit init done by vlc_stream_CustomNew().
  • The third commit adds missing attributes to the set vlc_stream_CustomNew() explicitly initialises to make the explicit init complete.
Edited by Lyndon Brown

Merge request reports

Merge request pipeline #179247 passed

Merge request pipeline passed for a9dd4b14

Merged by Hugo Beauzée-LuyssenHugo Beauzée-Luyssen 3 years ago (Jan 13, 2022 4:00pm UTC)

Loading

Pipeline #179253 passed

Pipeline passed for a9dd4b14 on master

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Lyndon Brown added 2 commits

    added 2 commits

    • e36170ef - Revert "stream: remove pointless & incomplete initialisation"
    • fc58043d - stream: add missing explicit initialisation

    Compare with previous version

  • Lyndon Brown resolved all threads

    resolved all threads

  • Lyndon Brown mentioned in merge request !1104 (merged)

    mentioned in merge request !1104 (merged)

  • Lyndon Brown changed the description

    changed the description

  • Lyndon Brown changed title from core: revert removed redundant init & init all attributes to core: revert removed explicit init & add missing init

    changed title from core: revert removed redundant init & init all attributes to core: revert removed explicit init & add missing init

  • Lyndon Brown changed the description

    changed the description

  • Lyndon Brown changed the description

    changed the description

  • MR Acceptance result

    :tada: This MergeRequest has been Accepted! Congratulations.

    MR acceptance checks details:

    • :white_check_mark: MR should be considered mergeable by Gitlab
    • :white_check_mark: Last pipeline should be successful
    • :white_check_mark: MergeRequest should have at least one external review and/or vote
    • :white_check_mark: All threads should be resolved, have votes and score > 0
    • :white_check_mark: MergeRequest should have no activity (threads/votes) for (72h/72h)

    This message was automatically generated by homer-bot.

  • added 91 commits

    • fc58043d...a7d0549c - 88 commits from branch videolan:master
    • f6dad0e9 - Revert "core: remove pointless re-initialisation of `stream_t` attributes"
    • cb54d4d5 - Revert "stream: remove pointless & incomplete initialisation"
    • a9dd4b14 - stream: add missing explicit initialisation

    Compare with previous version

  • Hugo Beauzée-Luyssen enabled an automatic merge when the pipeline for a9dd4b14 succeeds

    enabled an automatic merge when the pipeline for a9dd4b14 succeeds

  • Jean-Baptiste Kempf changed milestone to %4.0

    changed milestone to %4.0

  • Please register or sign in to reply
    Loading