Skip to content

Commit

Permalink
Use _POSIX_C_SOURCE, drop _BSD_SOURCE, _GNU_SOURCE (#5, #12)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
skeeto committed Jan 23, 2018
1 parent 62b099a commit d65f4c9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kilo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down

0 comments on commit d65f4c9

Please sign in to comment.