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

Fix build failure due to vasprintf on Windows #295

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions server/synctex_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -8415,7 +8415,8 @@ static int _synctex_updater_print(synctex_updater_p updater, const char * format
}
return result;
}
#if defined(_MSC_VER)
#if defined(_WIN32)
// define vasprintf as it’s available only on Linux and macOS.
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
Expand All @@ -8424,17 +8425,14 @@ static int vasprintf(char **ret,
const char *format,
va_list ap)
{
int len;
len = _vsnprintf(NULL, 0, format, ap);
int len = vsnprintf(NULL, 0, format, ap);
if (len < 0) return -1;
*ret = malloc(len + 1);
if (!*ret) return -1;
_vsnprintf(*ret, len+1, format, ap);
(*ret)[len] = '\0';
return len;
return vsnprintf(*ret, len + 1, format, ap);
}

#endif
#endif // _WIN32

/**
* gzvprintf is not available until OSX 10.10
Expand Down