| 1 |
/* |
| 2 |
* Copyright (C) 2026 Linux Studio Plugins Project <https://lsp-plug.in/> |
| 3 |
* (C) 2026 Vladimir Sadovnikov <[email protected]> |
| 4 |
* |
| 5 |
* This file is part of lsp-common-lib |
| 6 |
* Created on: 4 апр. 2020 г. |
| 7 |
* |
| 8 |
* lsp-common-lib is free software: you can redistribute it and/or modify |
| 9 |
* it under the terms of the GNU Lesser General Public License as published by |
| 10 |
* the Free Software Foundation, either version 3 of the License, or |
| 11 |
* any later version. |
| 12 |
* |
| 13 |
* lsp-common-lib is distributed in the hope that it will be useful, |
| 14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
* GNU Lesser General Public License for more details. |
| 17 |
* |
| 18 |
* You should have received a copy of the GNU Lesser General Public License |
| 19 |
* along with lsp-common-lib. If not, see <https://www.gnu.org/licenses/>. |
| 20 |
*/ |
| 21 |
|
| 22 |
#ifndef LSP_PLUG_IN_STDLIB_STDIO_H_ |
| 23 |
#define LSP_PLUG_IN_STDLIB_STDIO_H_ |
| 24 |
|
| 25 |
#include <lsp-plug.in/common/version.h> |
| 26 |
#include <lsp-plug.in/common/types.h> |
| 27 |
#include <stdio.h> |
| 28 |
|
| 29 |
namespace lsp |
| 30 |
{ |
| 31 |
#ifdef PLATFORM_WINDOWS |
| 32 |
typedef void *fhandle_t; |
| 33 |
|
| 34 |
LSP_COMMON_LIB_PUBLIC |
| 35 |
int vasprintf(char **strp, const char *fmt, va_list ap); |
| 36 |
|
| 37 |
LSP_COMMON_LIB_PUBLIC |
| 38 |
int asprintf(char **strp, const char *fmt, ...); |
| 39 |
|
| 40 |
LSP_COMMON_LIB_PUBLIC |
| 41 |
int fdsync(FILE *fd); |
| 42 |
|
| 43 |
#endif /* PLATFORM_WINDOWS */ |
| 44 |
|
| 45 |
#ifdef PLATFORM_UNIX_COMPATIBLE |
| 46 |
typedef int fhandle_t; |
| 47 |
|
| 48 |
LSP_COMMON_LIB_PUBLIC |
| 49 |
int fdsync(FILE *fd); |
| 50 |
|
| 51 |
#endif /* PLATFORM_UNIX_COMPATIBLE */ |
| 52 |
|
| 53 |
/** |
| 54 |
* Allocate memory for the string and perform formatted print to it. |
| 55 |
* The caller should free memory by issuing free() after use. |
| 56 |
* |
| 57 |
* @param fmt format string |
| 58 |
* @param ap argument list |
| 59 |
* @return pointer to allocated string or NULL |
| 60 |
*/ |
| 61 |
LSP_COMMON_LIB_PUBLIC |
| 62 |
char *vstrfmt(const char *fmt, va_list ap); |
| 63 |
|
| 64 |
/** |
| 65 |
* Allocate memory for the string and perform formatted print to it. |
| 66 |
* The caller should free memory by issuing free() after use. |
| 67 |
* |
| 68 |
* @param fmt format string |
| 69 |
* @return pointer to allocated string or NULL |
| 70 |
*/ |
| 71 |
LSP_COMMON_LIB_PUBLIC |
| 72 |
char *strfmt(const char *fmt, ...); |
| 73 |
|
| 74 |
} /* namespace lsp */ |
| 75 |
|
| 76 |
#endif /* LSP_PLUG_IN_STDLIB_STDIO_H_ */ |