diff options
| author | lin.sun <sunlin7@hotmail.com> | 2022-08-21 23:42:43 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-22 12:12:43 +0530 |
| commit | bea5ddb9fc234b48db6df3dcb66d75e76bec00c8 (patch) | |
| tree | 8b29bb5c40d5a083aaaf252eff068d86f76402bb /server/synctex_parser.c | |
| parent | c3d227c11bbeb18ea494fa832d0f23f71ccf9a9d (diff) | |
synctex_parser: fix vasprintf() not exists in non-GNU environment (#134)
The vasprintf() is a GNU extension function, missed in non-GNU build environment, so we define it.
Without this change, there will have error message when we build with clang:
```
./autogen.sh
./configure CC=clang
make
```
We will get errors:
```
synctex_parser.c:8448:13: error: call to undeclared function 'vasprintf'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
if (vasprintf(&buffer, format, va) < 0) {
```
This change fixes the problem.
Diffstat (limited to 'server/synctex_parser.c')
| -rw-r--r-- | server/synctex_parser.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/server/synctex_parser.c b/server/synctex_parser.c index 27be608..4eddb83 100644 --- a/server/synctex_parser.c +++ b/server/synctex_parser.c @@ -8415,9 +8415,7 @@ static int _synctex_updater_print(synctex_updater_p updater, const char * format } return result; } -#if defined(_MSC_VER) -#include <stdio.h> -#include <stdlib.h> +#ifndef HAVE_VASPRINTF #include <stdarg.h> static int vasprintf(char **ret, @@ -8425,11 +8423,11 @@ static int vasprintf(char **ret, va_list ap) { int len; - len = _vsnprintf(NULL, 0, format, ap); + 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); + vsnprintf(*ret, len + 1, format, ap); (*ret)[len] = '\0'; return len; } |
