Skip to content

Commit

Permalink
lib,bin: cleanup _{GNU,BSD,DEFAULT}_SOURCE, this shouldn't be per file
Browse files Browse the repository at this point in the history
  • Loading branch information
Duncaen committed Jan 10, 2024
1 parent b75e151 commit 48c9879
Show file tree
Hide file tree
Showing 12 changed files with 2 additions and 40 deletions.
2 changes: 0 additions & 2 deletions bin/xbps-fbulk/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@
* Only one attempt is made to build any given package, no matter how many
* other packages depend on it.
*/
#define _DEFAULT_SOURCE
#define _BSD_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
Expand Down
4 changes: 0 additions & 4 deletions bin/xbps-query/search.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifdef HAVE_STRCASESTR
# define _GNU_SOURCE /* for strcasestr(3) */
#endif

#include "compat.h"

#include <stdio.h>
Expand Down
2 changes: 0 additions & 2 deletions bin/xbps-uchroot/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
* - Supports overlayfs on a temporary directory or a tmpfs mount.
* - Supports read-only bind mounts.
*/
#define _GNU_SOURCE
#define _XOPEN_SOURCE 700
#include <sys/types.h>
#include <sys/prctl.h>
#include <sys/fsuid.h>
Expand Down
1 change: 0 additions & 1 deletion bin/xbps-uunshare/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#define _GNU_SOURCE
#include <sys/types.h>
#include <sys/mount.h>
#include <sys/fsuid.h>
Expand Down
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ echo "CC = $CC" >>$CONFIG_MK
echo "CFLAGS = -O2" >>$CONFIG_MK

echo "LDFLAGS = -L\$(TOPDIR)/lib" >>$CONFIG_MK
echo "CPPFLAGS = -I. -I\$(TOPDIR) -I\$(TOPDIR)/include" >>$CONFIG_MK
echo "CPPFLAGS = -D_DEFAULT_SOURCE -D_GNU_SOURCE -I. -I\$(TOPDIR) -I\$(TOPDIR)/include" >>$CONFIG_MK
echo "CPPFLAGS += -DXBPS_SYSCONF_PATH=\\\"${ETCDIR}\\\"" >>$CONFIG_MK
echo "CPPFLAGS += -DXBPS_SYSDEFCONF_PATH=\\\"${SHAREDIR}/xbps.d\\\"" >>$CONFIG_MK
echo "CPPFLAGS += -DXBPS_VERSION=\\\"${VERSION}\\\"" >>$CONFIG_MK
Expand Down
4 changes: 0 additions & 4 deletions lib/cb_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifdef HAVE_VASPRINTF
# define _GNU_SOURCE /* for vasprintf(3) */
#endif

#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
Expand Down
2 changes: 0 additions & 2 deletions lib/external/dewey.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@

#include <stdio.h>
#include <stdlib.h>
#define _BSD_SOURCE
#include <string.h>
#undef _BSD_SOURCE
#include <strings.h>
#include <ctype.h>

Expand Down
4 changes: 0 additions & 4 deletions lib/external/fexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#define _BSD_SOURCE /* for vfork and chroot */
#define _DEFAULT_SOURCE /* glibc>=2.20 */
#include <sys/types.h>
#include <unistd.h>

Expand All @@ -38,8 +36,6 @@
#include <stdlib.h>
#include <string.h>

#undef _DEFAULT_SOURCE
#undef _BSD_SOURCE
#include "xbps_api_impl.h"

static int
Expand Down
5 changes: 0 additions & 5 deletions lib/fetch/ftp.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@
*
*/

#ifdef __linux__
/* Keep this down to Linux, it can create surprises else where. */
#define _GNU_SOURCE
#endif

#include <sys/types.h>
#include <sys/socket.h>

Expand Down
4 changes: 0 additions & 4 deletions lib/fetch/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@
* SUCH DAMAGE.
*/

#if defined(__linux__)
#define _GNU_SOURCE
#endif

#include <sys/types.h>
#include <sys/socket.h>

Expand Down
4 changes: 1 addition & 3 deletions lib/portableproplib/prop_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@
static pthread_mutex_t _prop_refcnt_mtx = PTHREAD_MUTEX_INITIALIZER;
#endif /* _PROP_NEED_REFCNT_MTX */

#define __USE_MISC /* MAP_ANON on glibc */
# include <sys/mman.h>
#undef __USE_MISC
#include <sys/mman.h>
#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
Expand Down
8 changes: 0 additions & 8 deletions lib/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifdef HAVE_VASPRINTF
# define _GNU_SOURCE /* for vasprintf(3) */
#endif

#if defined(HAVE_STRLCAT) || defined(HAVE_STRLCPY)
# define _BSD_SOURCE
#endif

#include "compat.h"

#include <sys/utsname.h>
Expand Down

0 comments on commit 48c9879

Please sign in to comment.