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 asprintf() #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add asprintf() #4

wants to merge 1 commit into from

Conversation

timwoj
Copy link
Member

@timwoj timwoj commented Sep 25, 2023

Add an implementation of asprintf. The implementation of vasprintf already exists, so this just adds the wrapper version of it. This function is a POSIX method, not part of the C standard. It's defined on all of our other platforms but not on Windows. This makes the changes in zeek/zeek#3137 smaller.

@timwoj timwoj force-pushed the topic/timw/poll-asprintf branch from 301f0e2 to ded96fe Compare October 2, 2023 20:31
@timwoj timwoj changed the title Fix poll(), add asprintf() Add asprintf() Oct 2, 2023
va_start(ap, format);
int retval = vasprintf(strp, format, ap);
va_end(ap);
return returnval;
Copy link

Choose a reason for hiding this comment

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

Suggested change
return returnval;
return retval;

?

Is this still needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's not needed as I closed the PR this was needed for, but the change could still be useful.

@timwoj timwoj force-pushed the topic/timw/poll-asprintf branch from ded96fe to 63a19b2 Compare January 30, 2025 18:34
This should technically be in stdio.h but lives in unistd.h to avoid the
filename collision that would be created by adding a stdio.h.
@timwoj timwoj force-pushed the topic/timw/poll-asprintf branch from 63a19b2 to 98b5456 Compare January 30, 2025 18:48
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