moonbridge
changeset 209:5f529cb9b5c1
Avoid compiler warnings on GNU/Linux
author | jbe |
---|---|
date | Mon Jun 22 21:15:48 2015 +0200 (2015-06-22) |
parents | 77dc29ce7948 |
children | 7967c1e4f6d1 |
files | moonbridge_io.c |
line diff
1.1 --- a/moonbridge_io.c Mon Jun 22 00:19:19 2015 +0200 1.2 +++ b/moonbridge_io.c Mon Jun 22 21:15:48 2015 +0200 1.3 @@ -1,3 +1,7 @@ 1.4 + 1.5 +#ifndef __has_include 1.6 +#define __has_include(x) 0 1.7 +#endif 1.8 1.9 #if defined(__linux__) 1.10 #define _GNU_SOURCE 1.11 @@ -20,7 +24,10 @@ 1.12 #include <arpa/inet.h> 1.13 #include <sys/types.h> 1.14 #include <sys/wait.h> 1.15 - 1.16 +#if defined(__linux__) || __has_include(<bsd/unistd.h>) 1.17 +#include <bsd/unistd.h> 1.18 +#endif 1.19 + 1.20 #include <lua.h> 1.21 #include <lauxlib.h> 1.22 #include <lualib.h> 1.23 @@ -175,7 +182,7 @@ 1.24 moonbr_io_handle_t *handle; 1.25 lua_Integer maxread; 1.26 const char *terminatorstr; 1.27 - size_t terminatorlen; 1.28 + size_t terminatorlen = 0; /* initialize to avoid compiler warning */ 1.29 char terminator; 1.30 luaL_Buffer luabuf; 1.31 size_t luabufcnt = 0;