Fix wrong pointer type of static _dispatch_main_q
binding
#343
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While looking at a copy of this code (in another project that uses
objc2
, which does not yet definedispatch
integration) this strange cast immediately stands out._dispatch_main_q
is defined here as adispatch_queue_t
, thequeue
argument indispatch_data_create()
is also defined as adispatch_queue_t
, yet there is a "borrow" (get pointer to) operation before passing it into the function.Instead, this
static
field is supposed to be defined as theObject
itself, so that any user could take a pointer to it if they wish or need it so. The same is seen in thedispatch
crate:_dispatch_main_q
is defined as adispatch_object_s
, anddispatch_queue_t
is a typedef to a*mut dispatch_object_s
to match the above convention.Note that this is not a bugfix, but merely a readability improvement. Use of
mut
here is debatable.