diff options
| author | Joshua Watt <JPEWhacker@gmail.com> | 2019-10-25 21:03:23 -0500 |
|---|---|---|
| committer | Joshua Watt <JPEWhacker@gmail.com> | 2019-11-05 08:59:58 -0600 |
| commit | 4a1f348c20157db7bd7c759fdeb23fbe8729c571 (patch) | |
| tree | 3a788043096ae2a98f10e10ad94fc76236be4632 /src | |
| parent | adding O_RDWR flag in the open() (diff) | |
| download | wayland-4a1f348c20157db7bd7c759fdeb23fbe8729c571.tar wayland-4a1f348c20157db7bd7c759fdeb23fbe8729c571.tar.gz wayland-4a1f348c20157db7bd7c759fdeb23fbe8729c571.tar.bz2 wayland-4a1f348c20157db7bd7c759fdeb23fbe8729c571.tar.lz wayland-4a1f348c20157db7bd7c759fdeb23fbe8729c571.tar.xz wayland-4a1f348c20157db7bd7c759fdeb23fbe8729c571.tar.zst wayland-4a1f348c20157db7bd7c759fdeb23fbe8729c571.zip | |
scanner: Add configure check for strndup
Some platforms may not have strndup() (e.g. MinGW), so provide a
equivalent implementation if it's not found.
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/scanner.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/scanner.c b/src/scanner.c index 7ed1ba1..2b3adbd 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -975,6 +975,17 @@ verify_arguments(struct parse_context *ctx, } +#ifndef HAVE_STRNDUP +char * +strndup(const char *s, size_t size) +{ + char *r = malloc(size + 1); + strncpy(r, s, size); + r[size] = '\0'; + return r; +} +#endif + static void end_element(void *data, const XML_Char *name) { |
