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

Add FSStream and CFRunLoop bindings #40

Merged
merged 2 commits into from
Jan 17, 2025
Merged

Conversation

elcritch
Copy link
Contributor

I used these in dmon-nim and it's running.

I started creating my own macOS utilities before I found Darwin. Would much prefer to collaborate!

Feel free to edit to match your style or whatnot.

@yglukhov yglukhov merged commit e900969 into yglukhov:master Jan 17, 2025
1 check passed
@yglukhov
Copy link
Owner

Thanks! I will make some styling adjustments/renamings shortly. I'm also going to remove your custom allocator, please implement it elsewhere. Btw, why do you need it?

@yglukhov
Copy link
Owner

I will make some styling adjustments/renamings shortly. I'm also going to remove your custom allocator

Done in 63a4c09

@elcritch
Copy link
Contributor Author

Btw, why do you need it?

The FSStream requires passing a CFAllocator which it uses to allocate paths and stuff.

@yglukhov
Copy link
Owner

Sure but you can just use the cf default one, or even nil?

@elcritch
Copy link
Contributor Author

Sure but you can just use the cf default one, or even nil?

Can you? I was porting a C library and didn’t delve into it aside from copying what they did.

If I can use the default or nil it’d be simpler. Won’t cause memory leaks though will it?

@yglukhov
Copy link
Owner

As a rule of thumb you use kCFAllocatorDefault, and nil is a shortcut for that. No leaks, as long as you properly release everything. Custom allocators are almost never required in day to day app code.

@elcritch
Copy link
Contributor Author

As a rule of thumb you use kCFAllocatorDefault, and nil is a shortcut for that. No leaks, as long as you properly release everything. Custom allocators are almost never required in day to day app code.

Ah nice! I'll try that out then.

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