Test for preprocessor definition rather than value consistently everywhere
This is not supposed to actually change anything as such but inconsistency is bad and causes other kinds of headaches.
This commit is contained in:
parent
9ca1077c38
commit
48d0fa954c
|
@ -12,11 +12,11 @@
|
|||
#include <stdlib.h>
|
||||
#include <regex.h>
|
||||
#include <fcntl.h>
|
||||
#if WITH_CAP
|
||||
#ifdef WITH_CAP
|
||||
#include <sys/capability.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_LIBDW
|
||||
#ifdef HAVE_LIBDW
|
||||
#include <libelf.h>
|
||||
#include <elfutils/libdwelf.h>
|
||||
#endif
|
||||
|
@ -826,7 +826,7 @@ static rpmRC parseForCaps(char * buf, FileEntry cur)
|
|||
while (p <= pe)
|
||||
*p++ = ' ';
|
||||
|
||||
#if WITH_CAP
|
||||
#ifdef WITH_CAP
|
||||
{
|
||||
char *captxt = NULL;
|
||||
cap_t fcaps = cap_from_text(q);
|
||||
|
@ -1695,7 +1695,7 @@ static void argvAddAttr(ARGV_t *filesp, rpmfileAttrs attrs, const char *path)
|
|||
free(line);
|
||||
}
|
||||
|
||||
#if HAVE_LIBDW
|
||||
#ifdef HAVE_LIBDW
|
||||
/* How build id links are generated. See macros.in for description. */
|
||||
#define BUILD_IDS_NONE 0
|
||||
#define BUILD_IDS_ALLDEBUG 1
|
||||
|
@ -1878,7 +1878,7 @@ static int generateBuildIDs(FileList fl, ARGV_t *files)
|
|||
kernel modules (ET_REL files with .modinfo section)
|
||||
should have build-ids. */
|
||||
GElf_Ehdr ehdr;
|
||||
#if HAVE_DWELF_ELF_BEGIN
|
||||
#ifdef HAVE_DWELF_ELF_BEGIN
|
||||
Elf *elf = dwelf_elf_begin(fd);
|
||||
#else
|
||||
Elf *elf = elf_begin (fd, ELF_C_READ, NULL);
|
||||
|
@ -2624,7 +2624,7 @@ static rpmRC processPackageFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags,
|
|||
if (fl.processingFailed)
|
||||
goto exit;
|
||||
|
||||
#if HAVE_LIBDW
|
||||
#ifdef HAVE_LIBDW
|
||||
/* Check build-ids and add build-ids links for files to package list. */
|
||||
const char *arch = headerGetString(pkg->header, RPMTAG_ARCH);
|
||||
if (!rstreq(arch, "noarch")) {
|
||||
|
@ -3136,7 +3136,7 @@ rpmRC processBinaryFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags,
|
|||
should Recommend. */
|
||||
Package dbgsrcpkg = findDebugsourcePackage(spec);
|
||||
|
||||
#if HAVE_LIBDW
|
||||
#ifdef HAVE_LIBDW
|
||||
elf_version (EV_CURRENT);
|
||||
#endif
|
||||
check_fileList = newStringBuf();
|
||||
|
|
|
@ -297,13 +297,13 @@ static char *getIOFlags(Package pkg)
|
|||
compr = NULL;
|
||||
} else if (rstreq(s+1, "gzdio")) {
|
||||
compr = "gzip";
|
||||
#if HAVE_BZLIB_H
|
||||
#ifdef have_bzlib_h
|
||||
} else if (rstreq(s+1, "bzdio")) {
|
||||
compr = "bzip2";
|
||||
/* Add prereq on rpm version that understands bzip2 payloads */
|
||||
(void) rpmlibNeedsFeature(pkg, "PayloadIsBzip2", "3.0.5-1");
|
||||
#endif
|
||||
#if HAVE_LZMA_H
|
||||
#ifdef HAVE_LZMA_H
|
||||
} else if (rstreq(s+1, "xzdio")) {
|
||||
compr = "xz";
|
||||
(void) rpmlibNeedsFeature(pkg, "PayloadIsXz", "5.2-1");
|
||||
|
|
|
@ -768,7 +768,7 @@ static void addTargets(Package Pkgs)
|
|||
rpmRC checkForEncoding(Header h, int addtag)
|
||||
{
|
||||
rpmRC rc = RPMRC_OK;
|
||||
#if HAVE_ICONV
|
||||
#ifdef HAVE_ICONV
|
||||
const char *encoding = "utf-8";
|
||||
rpmTagVal tag;
|
||||
iconv_t ic;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
#include "debug.h"
|
||||
|
||||
#if WITH_SELINUX
|
||||
#ifdef WITH_SELINUX
|
||||
enum rpmpolFlags_e {
|
||||
RPMPOL_FLAG_NONE = 0,
|
||||
RPMPOL_FLAG_BASE = (1 << 0)
|
||||
|
@ -305,7 +305,7 @@ static rpmRC processPolicies(rpmSpec spec, Package pkg, int test)
|
|||
rpmRC processBinaryPolicies(rpmSpec spec, int test)
|
||||
{
|
||||
rpmRC rc = RPMRC_OK;
|
||||
#if WITH_SELINUX
|
||||
#ifdef WITH_SELINUX
|
||||
Package pkg;
|
||||
char *nvr;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "system.h"
|
||||
#if HAVE_MCHECK_H
|
||||
#ifdef HAVE_MCHECK_H
|
||||
#include <mcheck.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
|
|
@ -46,7 +46,7 @@ void dbiIndexSetSort(dbiIndexSet set)
|
|||
* than pure quicksort, but glibc uses msort_with_tmp() on stack.
|
||||
*/
|
||||
if (set && set->recs && set->count > 1) {
|
||||
#if HAVE_MERGESORT
|
||||
#ifdef HAVE_MERGESORT
|
||||
mergesort(set->recs, set->count, sizeof(*set->recs), hdrNumCmp);
|
||||
#else
|
||||
qsort(set->recs, set->count, sizeof(*set->recs), hdrNumCmp);
|
||||
|
|
|
@ -113,7 +113,7 @@ static inline void h2lea(unsigned int x, unsigned char *p)
|
|||
static void *mapmem(void *oldaddr, size_t oldsize, size_t newsize, int prot, int fd, off_t offset)
|
||||
{
|
||||
if (oldaddr) {
|
||||
#if HAVE_MREMAP
|
||||
#ifdef HAVE_MREMAP
|
||||
return mremap(oldaddr, oldsize, newsize, MREMAP_MAYMOVE);
|
||||
#else
|
||||
void *mapped = mmap(0, newsize, prot, MAP_SHARED, fd, offset);
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
|
||||
#include "system.h"
|
||||
|
||||
#if MAJOR_IN_MKDEV
|
||||
#if defined(MAJOR_IN_MKDEV)
|
||||
#include <sys/mkdev.h>
|
||||
#elif MAJOR_IN_SYSMACROS
|
||||
#elif defined(MAJOR_IN_SYSMACROS)
|
||||
#include <sys/sysmacros.h>
|
||||
#else
|
||||
#include <sys/types.h> /* already included from system.h */
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <utime.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#if WITH_CAP
|
||||
#ifdef WITH_CAP
|
||||
#include <sys/capability.h>
|
||||
#endif
|
||||
|
||||
|
@ -95,7 +95,7 @@ static int fsmLink(int odirfd, const char *opath, int dirfd, const char *path)
|
|||
return rc;
|
||||
}
|
||||
|
||||
#if WITH_CAP
|
||||
#ifdef WITH_CAP
|
||||
static int cap_set_fileat(int dirfd, const char *path, cap_t fcaps)
|
||||
{
|
||||
int rc = -1;
|
||||
|
@ -112,7 +112,7 @@ static int fsmSetFCaps(int fd, int dirfd, const char *path, const char *captxt)
|
|||
{
|
||||
int rc = 0;
|
||||
|
||||
#if WITH_CAP
|
||||
#ifdef WITH_CAP
|
||||
if (captxt && *captxt != '\0') {
|
||||
cap_t fcaps = cap_from_text(captxt);
|
||||
|
||||
|
@ -469,7 +469,7 @@ static void removeSBITS(int dirfd, const char *path)
|
|||
if ((stb.st_mode & 06000) != 0) {
|
||||
(void) fchmodat(dirfd, path, stb.st_mode & 0777, flags);
|
||||
}
|
||||
#if WITH_CAP
|
||||
#ifdef WITH_CAP
|
||||
if (stb.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH)) {
|
||||
(void) cap_set_fileat(dirfd, path, NULL);
|
||||
}
|
||||
|
|
|
@ -1069,12 +1069,12 @@ static const struct rpmlibProvides_s rpmlibProvides[] = {
|
|||
{ "rpmlib(CompressedFileNames)", "3.0.4-1",
|
||||
(RPMSENSE_RPMLIB|RPMSENSE_EQUAL),
|
||||
N_("file name(s) stored as (dirName,baseName,dirIndex) tuple, not as path.")},
|
||||
#if HAVE_BZLIB_H
|
||||
#ifdef HAVE_BZLIB_H
|
||||
{ "rpmlib(PayloadIsBzip2)", "3.0.5-1",
|
||||
(RPMSENSE_RPMLIB|RPMSENSE_EQUAL),
|
||||
N_("package payload can be compressed using bzip2.") },
|
||||
#endif
|
||||
#if HAVE_LZMA_H
|
||||
#ifdef HAVE_LZMA_H
|
||||
{ "rpmlib(PayloadIsXz)", "5.2-1",
|
||||
(RPMSENSE_RPMLIB|RPMSENSE_EQUAL),
|
||||
N_("package payload can be compressed using xz.") },
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
#endif
|
||||
|
||||
|
||||
#if HAVE_SYS_UTSNAME_H
|
||||
#ifdef HAVE_SYS_UTSNAME_H
|
||||
#include <sys/utsname.h>
|
||||
#endif
|
||||
#include <ctype.h> /* XXX for /etc/rpm/platform contents */
|
||||
|
||||
#if HAVE_SYS_SYSTEMCFG_H
|
||||
#ifdef HAVE_SYS_SYSTEMCFG_H
|
||||
#include <sys/systemcfg.h>
|
||||
#else
|
||||
#define __power_pc() 0
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
#include <fcntl.h>
|
||||
|
||||
/* duplicated from cpio.c */
|
||||
#if MAJOR_IN_MKDEV
|
||||
#if defined(MAJOR_IN_MKDEV)
|
||||
#include <sys/mkdev.h>
|
||||
#elif MAJOR_IN_SYSMACROS
|
||||
#elif defined(MAJOR_IN_SYSMACROS)
|
||||
#include <sys/sysmacros.h>
|
||||
#else
|
||||
#include <sys/types.h> /* already included from system.h */
|
||||
|
@ -1748,7 +1748,7 @@ static void rpmtsSync(rpmts ts)
|
|||
if (rpmChrootDone())
|
||||
return;
|
||||
|
||||
#if HAVE_SYNCFS
|
||||
#ifdef HAVE_SYNCFS
|
||||
for (rpmDiskSpaceInfo dsi = ts->dsi; dsi->bsize; dsi++) {
|
||||
int fd = open(dsi->mntPoint, O_RDONLY);
|
||||
if (fd != -1) {
|
||||
|
|
10
lib/verify.c
10
lib/verify.c
|
@ -7,10 +7,10 @@
|
|||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#if WITH_CAP
|
||||
#ifdef WITH_CAP
|
||||
#include <sys/capability.h>
|
||||
#endif
|
||||
#if WITH_ACL
|
||||
#ifdef WITH_ACL
|
||||
#include <acl/libacl.h>
|
||||
#endif
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
|||
#define S_ISDEV(m) (S_ISBLK((m)) || S_ISCHR((m)))
|
||||
|
||||
/* If cap_compare() (Linux extension) not available, do it the hard way */
|
||||
#if WITH_CAP && !defined(HAVE_CAP_COMPARE)
|
||||
#if defined(WITH_CAP) && !defined(HAVE_CAP_COMPARE)
|
||||
static int cap_compare(cap_t acap, cap_t bcap)
|
||||
{
|
||||
int rc = 0;
|
||||
|
@ -176,7 +176,7 @@ rpmVerifyAttrs rpmfilesVerify(rpmfiles fi, int ix, rpmVerifyAttrs omitMask)
|
|||
if (metamode != filemode)
|
||||
vfy |= RPMVERIFY_MODE;
|
||||
|
||||
#if WITH_ACL
|
||||
#ifdef WITH_ACL
|
||||
/*
|
||||
* For now, any non-default acl's on a file is a difference as rpm
|
||||
* cannot have set them.
|
||||
|
@ -204,7 +204,7 @@ rpmVerifyAttrs rpmfilesVerify(rpmfiles fi, int ix, rpmVerifyAttrs omitMask)
|
|||
}
|
||||
}
|
||||
|
||||
#if WITH_CAP
|
||||
#ifdef WITH_CAP
|
||||
if (flags & RPMVERIFY_CAPS) {
|
||||
cap_t cap = NULL;
|
||||
cap_t fcap = cap_get_file(fn);
|
||||
|
|
|
@ -388,7 +388,7 @@ static int Psleep(lua_State *L) /** sleep(seconds) */
|
|||
|
||||
static int Pputenv(lua_State *L) /** putenv(string) */
|
||||
{
|
||||
#if HAVE_PUTENV
|
||||
#ifdef HAVE_PUTENV
|
||||
size_t l;
|
||||
const char *s=luaL_checklstring(L, 1, &l);
|
||||
char *e=malloc(++l);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include <stdarg.h>
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
#if HAVE_SCHED_GETAFFINITY
|
||||
#ifdef HAVE_SCHED_GETAFFINITY
|
||||
#include <sched.h>
|
||||
#endif
|
||||
|
||||
|
@ -600,7 +600,7 @@ exit:
|
|||
static unsigned int getncpus(void)
|
||||
{
|
||||
unsigned int ncpus = 0;
|
||||
#if HAVE_SCHED_GETAFFINITY
|
||||
#ifdef HAVE_SCHED_GETAFFINITY
|
||||
cpu_set_t set;
|
||||
if (sched_getaffinity (0, sizeof(set), &set) == 0)
|
||||
ncpus = CPU_COUNT(&set);
|
||||
|
|
|
@ -151,7 +151,7 @@ struct FDIO_s {
|
|||
static const FDIO_t fdio;
|
||||
static const FDIO_t ufdio;
|
||||
static const FDIO_t gzdio;
|
||||
#if HAVE_BZLIB_H
|
||||
#ifdef HAVE_BZLIB_H
|
||||
static const FDIO_t bzdio;
|
||||
#endif
|
||||
#ifdef HAVE_LZMA_H
|
||||
|
@ -617,7 +617,7 @@ static int gzdSeek(FDSTACK_t fps, off_t pos, int whence)
|
|||
{
|
||||
off_t p = pos;
|
||||
int rc;
|
||||
#if HAVE_GZSEEK
|
||||
#ifdef HAVE_GZSEEK
|
||||
gzFile gzfile = fps->fp;
|
||||
|
||||
if (gzfile == NULL) return -2; /* XXX can't happen */
|
||||
|
@ -649,7 +649,7 @@ static off_t gzdTell(FDSTACK_t fps)
|
|||
gzFile gzfile = fps->fp;
|
||||
|
||||
if (gzfile != NULL) {
|
||||
#if HAVE_GZSEEK
|
||||
#ifdef HAVE_GZSEEK
|
||||
pos = gztell(gzfile);
|
||||
if (pos < 0)
|
||||
gzdSetError(fps);
|
||||
|
@ -668,7 +668,7 @@ static const FDIO_t gzdio = &gzdio_s ;
|
|||
|
||||
/* =============================================================== */
|
||||
/* Support for BZIP2 library. */
|
||||
#if HAVE_BZLIB_H
|
||||
#ifdef HAVE_BZLIB_H
|
||||
|
||||
#include <bzlib.h>
|
||||
|
||||
|
@ -1547,10 +1547,10 @@ static FDIO_t findIOT(const char *name)
|
|||
&fdio_s,
|
||||
&ufdio_s,
|
||||
&gzdio_s,
|
||||
#if HAVE_BZLIB_H
|
||||
#ifdef HAVE_BZLIB_H
|
||||
&bzdio_s,
|
||||
#endif
|
||||
#if HAVE_LZMA_H
|
||||
#ifdef HAVE_LZMA_H
|
||||
&xzdio_s,
|
||||
&lzdio_s,
|
||||
#endif
|
||||
|
|
|
@ -30,7 +30,7 @@ static struct poptOption specOptsTable[] = {
|
|||
N_("parse spec file(s) to stdout"), NULL },
|
||||
{ "query", 'q', POPT_ARG_VAL, &mode, MODE_QUERY,
|
||||
N_("query spec file(s)"), NULL },
|
||||
#if HAVE_READLINE
|
||||
#ifdef HAVE_READLINE
|
||||
{ "shell", 0, POPT_ARG_VAL, &mode, MODE_SHELL,
|
||||
N_("interactive macro shell"), NULL },
|
||||
#endif
|
||||
|
|
8
system.h
8
system.h
|
@ -29,13 +29,13 @@ extern char ** environ;
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if HAVE_SECURE_GETENV
|
||||
#if defined(HAVE_SECURE_GETENV)
|
||||
#define getenv(_s) secure_getenv(_s)
|
||||
#elif HAVE___SECURE_GETENV
|
||||
#elif defined(HAVE___SECURE_GETENV)
|
||||
#define getenv(_s) __secure_getenv(_s)
|
||||
#endif
|
||||
|
||||
#if HAVE_LIMITS_H
|
||||
#ifdef HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
|
@ -82,7 +82,7 @@ extern int fdatasync(int fildes);
|
|||
#endif
|
||||
|
||||
/* Take care of NLS matters. */
|
||||
#if ENABLE_NLS
|
||||
#if defined(ENABLE_NLS)
|
||||
# include <locale.h>
|
||||
# include <libintl.h>
|
||||
# define _(Text) dgettext (PACKAGE, Text)
|
||||
|
|
Loading…
Reference in New Issue