Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introduce void* parameter for user data in listeners #207

Open
wants to merge 2 commits into
base: feat/runtime-api-enforcement
Choose a base branch
from

Conversation

Xavrax
Copy link
Contributor

@Xavrax Xavrax commented Feb 19, 2025

feat: introduce void* parameter for user data in listeners

Introduce void* parameter for user data in listeners to let callbacks keep context on demand.

@Xavrax Xavrax changed the base branch from master to feat/runtime-api-enforcement February 19, 2025 15:03
Copy link
Contributor

@parfeon parfeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is suggestion on how we can keep things aligned without unnecessary branching.

Comment on lines +268 to +278
pbcc_status_listener_t* pbcc_status_listener_alloc_(
pubnub_subscribe_status_callback_t callback,
void* user_data)
{
PBCC_ALLOCATE_TYPE(listener, pbcc_status_listener_t, true, NULL);
listener->callback = callback;
listener->user_data = user_data;

return listener;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we actually need this?

Can we go in other way and do the following:

  1. for pubnub_subscribe_listener_type add PBSL_LISTENER_ON_STATUS
  2. Modify pbcc_event_listener_add_status_listener and pbcc_event_listener_remove_status_listener?

Also we will probably will need to make a change to:

pbcc_initialize_array_(&listener->global_status, NULL))

and add destructor call:

pbcc_initialize_array_(&listener->global_status, pbcc_listener_free_))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants