From 2536192624f9a87c877f500a6e187b94385ec572 Mon Sep 17 00:00:00 2001 From: Silvan Date: Wed, 16 Aug 2023 13:00:04 +0200 Subject: [PATCH] Code updates to current gcc --- CMakeLists.txt | 4 ++-- src/backend-sqlite3.c | 2 ++ src/buildtools.c | 11 +---------- src/changelog.c | 21 --------------------- src/distromatic.c | 35 +---------------------------------- src/distroquery.c | 40 +--------------------------------------- src/functions.c | 35 +---------------------------------- src/headerlist.c | 21 +-------------------- src/include/changelog.h | 11 ----------- src/reports.c | 11 ++--------- src/requirelist.c | 20 +------------------- src/rpmfunctions.c | 11 +---------- 12 files changed, 13 insertions(+), 209 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4cbe091..20da030 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ -project(distromatic) - cmake_minimum_required(VERSION 3.10.0 FATAL_ERROR) +project(distromatic) + set(LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/locale") if (NOT SYSCONF_INSTALL_DIR) diff --git a/src/backend-sqlite3.c b/src/backend-sqlite3.c index 11695e0..c7b977b 100644 --- a/src/backend-sqlite3.c +++ b/src/backend-sqlite3.c @@ -17,7 +17,9 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ +#include #include +#include #include "headerlist.h" #include "changelog.h" #include "backend-sqlite3.h" diff --git a/src/buildtools.c b/src/buildtools.c index ff94a0b..bb9b55e 100644 --- a/src/buildtools.c +++ b/src/buildtools.c @@ -18,16 +18,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H -# include -# endif -# include -#endif -#if HAVE_STRINGS_H -# include -#endif - +#include #include #include "distromatic.h" diff --git a/src/changelog.c b/src/changelog.c index 0cd5d69..a847cd9 100644 --- a/src/changelog.c +++ b/src/changelog.c @@ -18,27 +18,6 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ -#if TIME_WITH_SYS_TIME -# include -# include -#else -# if HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif - -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H -# include -# endif -# include -#endif -#if HAVE_STRINGS_H -# include -#endif - #include #include "distromatic.h" diff --git a/src/distromatic.c b/src/distromatic.c index 9b296a8..04dfb1c 100644 --- a/src/distromatic.c +++ b/src/distromatic.c @@ -35,42 +35,9 @@ #include #include -#if HAVE_UNISTD_H -# include -#endif - #include #include - -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H -# include -# endif -/* Tell glibc's to provide a prototype for strndup() */ -# ifndef __USE_GNU -# define __USE_GNU -# endif -# include -#endif -#if HAVE_STRINGS_H -# include -#endif - - -#if TIME_WITH_SYS_TIME -# include -# include -#else -# if HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif - -#if !HAVE_STRCHR -# define strchr index -#endif +#include #include "buildtools.h" #include "changelog.h" diff --git a/src/distroquery.c b/src/distroquery.c index 8b56e69..1b06dc2 100644 --- a/src/distroquery.c +++ b/src/distroquery.c @@ -28,50 +28,12 @@ #include #define _(x) gettext(x) -#if HAVE_UNISTD_H -# include -#endif - #include #include #include #include #include - -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H -# include -# endif -/* Tell glibc's to provide a prototype for strndup() */ -# ifndef __USE_GNU -# define __USE_GNU -# endif -# include -#endif -#if HAVE_STRINGS_H -# include -#endif - -/* Tell glibc's to provide a prototype for strptime() */ -#ifndef __USE_XOPEN -# define __USE_XOPEN -#endif - -#if TIME_WITH_SYS_TIME -# include -# include -#else -# if HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif - -#if !HAVE_STRCHR -# define strchr index -#endif - +#include #include #include "distromatic.h" #include "config.h" diff --git a/src/functions.c b/src/functions.c index b319c43..d71b107 100644 --- a/src/functions.c +++ b/src/functions.c @@ -18,50 +18,17 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ -#if STDC_HEADERS -# include -# include -#else -# if HAVE_STDLIB_H -# include -# endif -#endif - #include +#include #include #include #include -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H -# include -# endif -# include -#endif -#if HAVE_STRINGS_H -# include -#endif - -#ifdef HAVE_LIBIBERTY_H -# include -#endif - /* Tell glibc's to provide a prototype for strptime() */ #ifndef __USE_XOPEN # define __USE_XOPEN #endif -#if TIME_WITH_SYS_TIME -# include -# include -#else -# if HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif - #include "distromatic.h" #include "config.h" #include "functions.h" diff --git a/src/headerlist.c b/src/headerlist.c index b4958fc..42e3bc0 100644 --- a/src/headerlist.c +++ b/src/headerlist.c @@ -35,25 +35,6 @@ #define rpmReadPackageFile(a,b,c,d) rpmReadPackageHeader(b,d,0,NULL,NULL) #endif -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H -# include -# endif -# include -#endif -#if HAVE_STRINGS_H -# include -#endif - -#if STDC_HEADERS -# include -# include -#else -# if HAVE_STDLIB_H -# include -# endif -#endif - #include "distromatic.h" #include "config.h" #include "changelog.h" @@ -277,7 +258,7 @@ generateHeaderStats(struct configTag *ct, int arch) stats->headerlistvec[arch] = malloc(sizeof(struct headerList *) * stats->headercount[arch]); - if (!stats->headerlistvec) { + if (!stats->headerlistvec[arch]) { return 1; } diff --git a/src/include/changelog.h b/src/include/changelog.h index 114830a..8af722f 100644 --- a/src/include/changelog.h +++ b/src/include/changelog.h @@ -8,17 +8,6 @@ #ifndef CHANGELOG_H #define CHANGELOG_H -#if TIME_WITH_SYS_TIME -# include -# include -#else -# if HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif - #include "distromatic.h" #include "config.h" #include "rpmfunctions.h" diff --git a/src/reports.c b/src/reports.c index 0c750ad..018f9f1 100644 --- a/src/reports.c +++ b/src/reports.c @@ -18,15 +18,8 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H -# include -# endif -# include -#endif -#if HAVE_STRINGS_H -# include -#endif +#include +#include #include "distromatic.h" #include "changelog.h" diff --git a/src/requirelist.c b/src/requirelist.c index 7791604..841ef70 100644 --- a/src/requirelist.c +++ b/src/requirelist.c @@ -18,26 +18,8 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ -#if STDC_HEADERS -# include -# include -#else -# if HAVE_STDLIB_H -# include -# endif -#endif - #include - -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H -# include -# endif -# include -#endif -#if HAVE_STRINGS_H -# include -#endif +#include #ifndef HEADERLIST_H # include "headerlist.h" diff --git a/src/rpmfunctions.c b/src/rpmfunctions.c index e19ed5a..0833585 100644 --- a/src/rpmfunctions.c +++ b/src/rpmfunctions.c @@ -18,16 +18,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H -# include -# endif -# include -#endif -#if HAVE_STRINGS_H -# include -#endif - +#include #include #include #include