summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Wellons <wellons@nullprogram.com>2018-01-23 08:27:30 -0500
committerChristopher Wellons <wellons@nullprogram.com>2018-01-23 08:27:30 -0500
commitd65f4c92e8ed405937a7bac3248d24fa6b40eb6f (patch)
tree198845f96c8783731734784ae0d3461ad7947486
parent62b099af00b542bdb08471058d527af258a349cf (diff)
downloadfilo-d65f4c92e8ed405937a7bac3248d24fa6b40eb6f.tar.gz
filo-d65f4c92e8ed405937a7bac3248d24fa6b40eb6f.zip
Use _POSIX_C_SOURCE, drop _BSD_SOURCE, _GNU_SOURCE (#5, #12)
The only need for _BSD_SOURCE is a single use of the trivial, but non-standard, strdup(). The only need for _GNU_SOURCE is for getline(). This function was standardized by POSIX 10 years ago, so you only need to ask for it with _POSIX_C_SOURCE. Also added time.h which is only included by luck from the removed feature test macros. This is better than PR #5 because _DEFAULT_SOURCE isn't needed at all.
-rw-r--r--kilo.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kilo.c b/kilo.c
index 9490a77..5405e45 100644
--- a/kilo.c
+++ b/kilo.c
@@ -34,8 +34,7 @@
#define KILO_VERSION "0.0.1"
-#define _BSD_SOURCE
-#define _GNU_SOURCE
+#define _POSIX_C_SOURCE 200809L
#include <termios.h>
#include <stdlib.h>
@@ -44,6 +43,7 @@
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
+#include <time.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/time.h>