diff options
author | 2018-02-24 20:22:57 -0500 | |
---|---|---|
committer | 2018-02-24 20:22:57 -0500 | |
commit | 9141f0d9703447bbee1026f9d4b55a86b93d69b7 (patch) | |
tree | 394d94c4434ea300566ec7587a97008cfb006c3a /src/textadept.c | |
parent | 93e5ca4550c41d611892e31a8499171699822264 (diff) | |
download | textadept-9141f0d9703447bbee1026f9d4b55a86b93d69b7.tar.gz textadept-9141f0d9703447bbee1026f9d4b55a86b93d69b7.zip |
Define header flags in source code rather than in Makefile.
Requires lspawn r60 (changeset 9a8b4b5e4137) and gtdialog r112 (changeset
6435a42450c7).
Diffstat (limited to 'src/textadept.c')
-rw-r--r-- | src/textadept.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/textadept.c b/src/textadept.c index 156ffcbf..3be679b1 100644 --- a/src/textadept.c +++ b/src/textadept.c @@ -1,5 +1,9 @@ // Copyright 2007-2018 Mitchell mitchell.att.foicica.com. See LICENSE. +#if __linux__ +#define _XOPEN_SOURCE 500 // for readlink from unistd.h +#endif + // Library includes. #include <errno.h> #include <locale.h> @@ -17,7 +21,6 @@ #elif __APPLE__ #include <mach-o/dyld.h> #elif (__FreeBSD__ || __NetBSD__ || __OpenBSD__) -#define u_int unsigned int // 'u_int' undefined when _POSIX_SOURCE is defined #include <sys/types.h> #include <sys/sysctl.h> #endif @@ -1377,11 +1380,11 @@ static int lquit(lua_State *L) { return 0; } -#if _WIN32 -char *stpcpy(char *dest, const char *src) { +// stpcpy() does not exist on _WIN32, but exists on other platforms with or +// without feature test macros. In order to minimize confusion, just define it. +char *stpcpy_(char *dest, const char *src) { return (strcpy(dest, src), dest + strlen(src)); } -#endif /** * Loads and runs the given file. @@ -1391,7 +1394,7 @@ char *stpcpy(char *dest, const char *src) { */ static int lL_dofile(lua_State *L, const char *filename) { char *file = malloc(strlen(textadept_home) + 1 + strlen(filename) + 1); - stpcpy(stpcpy(stpcpy(file, textadept_home), "/"), filename); + stpcpy_(stpcpy_(stpcpy_(file, textadept_home), "/"), filename); int ok = (luaL_dofile(L, file) == LUA_OK); if (!ok) { #if GTK |