RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/lib/ fs.c rpm/misc/ error.c getmntent.c mktime.c setenv...

From: Ralf S. Engelschall <rse@rpm5.org>
Date: Mon 16 Jul 2007 - 11:14:57 CEST
Message-Id: <20070716091457.6C0FD3484F3@rpm5.org>
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Ralf S. Engelschall
  Root:   /v/rpm/cvs                       Email:  rse@rpm5.org
  Module: rpm                              Date:   16-Jul-2007 11:14:57
  Branch: HEAD                             Handle: 2007071610145601

  Modified files:
    rpm                     system.h
    rpm/lib                 fs.c
    rpm/misc                error.c getmntent.c mktime.c setenv.c strcspn.c
                            strftime.c
    rpm/rpmio               rpmio_internal.h sha224.c

  Log:
    Fix the remaining set of incorrect usages of the Autoconf HAVE_XXXX
    defines.

  Summary:
    Revision    Changes     Path
    2.54        +5  -5      rpm/lib/fs.c
    1.3         +5  -5      rpm/misc/error.c
    1.9         +1  -1      rpm/misc/getmntent.c
    1.2         +1  -1      rpm/misc/mktime.c
    1.4         +3  -3      rpm/misc/setenv.c
    1.2         +2  -2      rpm/misc/strcspn.c
    1.2         +14 -14     rpm/misc/strftime.c
    2.77        +1  -1      rpm/rpmio/rpmio_internal.h
    1.4         +2  -2      rpm/rpmio/sha224.c
    2.68        +37 -37     rpm/system.h
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/lib/fs.c
  ============================================================================
  $ cvs diff -u -r2.53 -r2.54 fs.c
  --- rpm/lib/fs.c	16 Jul 2007 01:32:28 -0000	2.53
  +++ rpm/lib/fs.c	16 Jul 2007 09:14:56 -0000	2.54
  @@ -162,14 +162,14 @@
   		     strerror(errno));
   	    return 1;
   	}
  -#   elif HAVE_GETMNTINFO_R
  +#   elif defined(HAVE_GETMNTINFO_R)
       /* This is OSF */
       struct statfs * mounts = NULL;
       int mntCount = 0, bufSize = 0, flags = MNT_NOWAIT;
       int nextMount = 0;
   
   	getmntinfo_r(&mounts, flags, &mntCount, &bufSize);
  -#   elif HAVE_GETMNTINFO
  +#   elif defined(HAVE_GETMNTINFO)
       /* This is Mac OS X */
   #if defined(__NetBSD__)
       struct statvfs * mounts = NULL;
  @@ -207,11 +207,11 @@
   	    /* Solaris, maybe others */
   	    if (getmntent(mtab, &item)) break;
   	    mntdir = item.our_mntdir;
  -#	elif HAVE_GETMNTINFO_R
  +#	elif defined(HAVE_GETMNTINFO_R)
   	    /* This is OSF */
   	    if (nextMount == mntCount) break;
   	    mntdir = mounts[nextMount++].f_mntonname;
  -#	elif HAVE_GETMNTINFO
  +#	elif defined(HAVE_GETMNTINFO)
   	    /* This is Mac OS X */
   	    if (nextMount == mntCount) break;
   	    mntdir = mounts[nextMount++].f_mntonname;
  @@ -253,7 +253,7 @@
   
   #   if GETMNTENT_ONE || GETMNTENT_TWO
   	(void) fclose(mtab);
  -#   elif HAVE_GETMNTINFO_R
  +#   elif defined(HAVE_GETMNTINFO_R)
   	mounts = _free(mounts);
   #   endif
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/misc/error.c
  ============================================================================
  $ cvs diff -u -r1.2 -r1.3 error.c
  --- rpm/misc/error.c	20 Sep 1999 15:35:08 -0000	1.2
  +++ rpm/misc/error.c	16 Jul 2007 09:14:56 -0000	1.3
  @@ -27,7 +27,7 @@
   
   #include <stdio.h>
   
  -#if HAVE_VPRINTF || HAVE_DOPRNT || _LIBC
  +#if defined(HAVE_VPRINTF) || defined(HAVE_DOPRNT) || _LIBC
   # if __STDC__
   #  include <stdarg.h>
   #  define VA_START(args, lastarg) va_start(args, lastarg)
  @@ -40,7 +40,7 @@
   # define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8;
   #endif
   
  -#if STDC_HEADERS || _LIBC
  +#if defined(STDC_HEADERS) || _LIBC
   # include <stdlib.h>
   # include <string.h>
   #else
  @@ -90,7 +90,7 @@
   # ifdef HAVE_STRERROR_R
   #  define __strerror_r strerror_r
   # else
  -#  if HAVE_STRERROR
  +#  ifdef HAVE_STRERROR
   #   ifndef strerror		/* On some systems, strerror is a macro */
   char *strerror ();
   #   endif
  @@ -142,7 +142,7 @@
   
   #ifdef VA_START
     VA_START (args, message);
  -# if HAVE_VPRINTF || _LIBC
  +# if defined(HAVE_VPRINTF) || _LIBC
     vfprintf (stderr, message, args);
   # else
     _doprnt (message, args, stderr);
  @@ -217,7 +217,7 @@
   
   #ifdef VA_START
     VA_START (args, message);
  -# if HAVE_VPRINTF || _LIBC
  +# if defined(HAVE_VPRINTF) || _LIBC
     vfprintf (stderr, message, args);
   # else
     _doprnt (message, args, stderr);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/misc/getmntent.c
  ============================================================================
  $ cvs diff -u -r1.8 -r1.9 getmntent.c
  --- rpm/misc/getmntent.c	30 Jul 1998 22:10:56 -0000	1.8
  +++ rpm/misc/getmntent.c	16 Jul 2007 09:14:56 -0000	1.9
  @@ -6,7 +6,7 @@
   #define COMMENTCHAR '#'
   #endif
   
  -#if HAVE_STRUCT_MNTTAB 
  +#if defined(HAVE_STRUCT_MNTTAB)
   our_mntent * getmntent(FILE *filep) {
       static struct mnttab entry;
       static our_mntent item;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/misc/mktime.c
  ============================================================================
  $ cvs diff -u -r1.1 -r1.2 mktime.c
  --- rpm/misc/mktime.c	8 Oct 1998 10:40:44 -0000	1.1
  +++ rpm/misc/mktime.c	16 Jul 2007 09:14:56 -0000	1.2
  @@ -101,7 +101,7 @@
   			       time_t *));
   
   
  -#if ! HAVE_LOCALTIME_R && ! defined (localtime_r)
  +#if ! defined(HAVE_LOCALTIME_R) && ! defined (localtime_r)
   #ifdef _LIBC
   #define localtime_r __localtime_r
   #else
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/misc/setenv.c
  ============================================================================
  $ cvs diff -u -r1.3 -r1.4 setenv.c
  --- rpm/misc/setenv.c	10 Mar 2000 22:02:29 -0000	1.3
  +++ rpm/misc/setenv.c	16 Jul 2007 09:14:56 -0000	1.4
  @@ -26,13 +26,13 @@
   # define __set_errno(ev) ((errno) = (ev))
   #endif
   
  -#if _LIBC || HAVE_STDLIB_H
  +#if _LIBC || defined(HAVE_STDLIB_H)
   # include <stdlib.h>
   #endif
  -#if _LIBC || HAVE_STRING_H
  +#if _LIBC || defined(HAVE_STRING_H)
   # include <string.h>
   #endif
  -#if _LIBC || HAVE_UNISTD_H
  +#if _LIBC || defined(HAVE_UNISTD_H)
   # include <unistd.h>
   #endif
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/misc/strcspn.c
  ============================================================================
  $ cvs diff -u -r1.1 -r1.2 strcspn.c
  --- rpm/misc/strcspn.c	8 Oct 1998 18:50:06 -0000	1.1
  +++ rpm/misc/strcspn.c	16 Jul 2007 09:14:56 -0000	1.2
  @@ -18,11 +18,11 @@
      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
      USA.  */
   
  -#if HAVE_CONFIG_H
  +#ifdef HAVE_CONFIG_H
   # include <config.h>
   #endif
   
  -#if defined _LIBC || HAVE_STRING_H
  +#if defined _LIBC || defined HAVE_STRING_H
   # include <string.h>
   #else
   # include <strings.h>
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/misc/strftime.c
  ============================================================================
  $ cvs diff -u -r1.1 -r1.2 strftime.c
  --- rpm/misc/strftime.c	8 Oct 1998 10:40:48 -0000	1.1
  +++ rpm/misc/strftime.c	16 Jul 2007 09:14:56 -0000	1.2
  @@ -49,7 +49,7 @@
   #  include <time.h>
   # endif
   #endif
  -#if HAVE_TZNAME
  +#ifdef HAVE_TZNAME
   extern char *tzname[];
   #endif
   
  @@ -59,10 +59,10 @@
      conversion specifications.  The GNU C Library uses UTF8 multibyte
      encoding, which is safe for formats, but strftime.c can be used
      with other C libraries that use unsafe encodings.  */
  -#define DO_MULTIBYTE (HAVE_MBLEN && ! MULTIBYTE_IS_FORMAT_SAFE)
  +#define DO_MULTIBYTE (defined(HAVE_MBLEN) && ! defined(MULTIBYTE_IS_FORMAT_SAFE))
   
   #if DO_MULTIBYTE
  -# if HAVE_MBRLEN
  +# ifdef HAVE_MBRLEN
   #  include <wchar.h>
   # else
      /* Simulate mbrlen with mblen as best we can.  */
  @@ -73,7 +73,7 @@
     static const mbstate_t mbstate_zero;
   #endif
   
  -#if HAVE_LIMITS_H
  +#if defined(HAVE_LIMITS_H)
   # include <limits.h>
   #endif
   
  @@ -136,8 +136,8 @@
   # define tzname __tzname
   # define tzset __tzset
   #else
  -# if ! HAVE_LOCALTIME_R
  -#  if ! HAVE_TM_GMTOFF
  +# if ! defined(HAVE_LOCALTIME_R)
  +#  if ! defined(HAVE_TM_GMTOFF)
   /* Approximate gmtime_r as best we can in its absence.  */
   #  define gmtime_r my_gmtime_r
   static struct tm *gmtime_r __P ((const time_t *, struct tm *));
  @@ -330,7 +330,7 @@
   #endif
   
   
  -#if !defined _LIBC && HAVE_TZNAME && HAVE_TZSET
  +#if !defined _LIBC && defined(HAVE_TZNAME) && defined(HAVE_TZSET)
     /* Solaris 2.5 tzset sometimes modifies the storage returned by localtime.
        Work around this bug by copying *tp before it might be munged.  */
     size_t _strftime_copytm __P ((char *, size_t, const char *,
  @@ -397,7 +397,7 @@
     const char *f;
   
     zone = NULL;
  -#if !defined _LIBC && HAVE_TM_ZONE
  +#if !defined _LIBC && defined(HAVE_TM_ZONE)
     /* XXX We have some problems here.  First, the string pointed to by
        tm_zone is dynamically allocated while loading the zone data.  But
        when another zone is loaded since the information in TP were
  @@ -408,11 +408,11 @@
        TP is computed with a totally different time zone.  --drepper@gnu  */
     zone = (const char *) tp->tm_zone;
   #endif
  -#if HAVE_TZNAME
  +#if defined(HAVE_TZNAME)
     /* POSIX.1 8.1.1 requires that whenever strftime() is called, the
        time zone names contained in the external variable `tzname' shall
        be set as if the tzset() function had been called.  */
  -# if HAVE_TZSET
  +# if defined(HAVE_TZSET)
     tzset ();
   # endif
   
  @@ -638,7 +638,7 @@
   	case 'C':		/* POSIX.2 extension.  */
   	  if (modifier == 'O')
   	    goto bad_format;
  -#if HAVE_STRUCT_ERA_ENTRY
  +#if defined(HAVE_STRUCT_ERA_ENTRY)
   	  if (modifier == 'E')
   	    {
   	      struct era_entry *era = _nl_get_era_entry (tp);
  @@ -944,7 +944,7 @@
   	  DO_NUMBER (1, tp->tm_wday);
   
   	case 'Y':
  -#if HAVE_STRUCT_ERA_ENTRY
  +#if defined(HAVE_STRUCT_ERA_ENTRY)
   	  if (modifier == 'E')
   	    {
   	      struct era_entry *era = _nl_get_era_entry (tp);
  @@ -961,7 +961,7 @@
   	    DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE);
   
   	case 'y':
  -#if HAVE_STRUCT_ERA_ENTRY
  +#if defined(HAVE_STRUCT_ERA_ENTRY)
   	  if (modifier == 'E')
   	    {
   	      struct era_entry *era = _nl_get_era_entry (tp);
  @@ -985,7 +985,7 @@
   
   	  {
   	    int diff;
  -#if HAVE_TM_GMTOFF
  +#if defined(HAVE_TM_GMTOFF)
   	    diff = tp->tm_gmtoff;
   #else
   	    struct tm gtm;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmio_internal.h
  ============================================================================
  $ cvs diff -u -r2.76 -r2.77 rpmio_internal.h
  --- rpm/rpmio/rpmio_internal.h	10 Jul 2007 19:04:55 -0000	2.76
  +++ rpm/rpmio/rpmio_internal.h	16 Jul 2007 09:14:57 -0000	2.77
  @@ -9,7 +9,7 @@
   #include <rpmio.h>
   #include <rpmurl.h>
   
  -#if HAVE_BEECRYPT_API_H
  +#ifdef HAVE_BEECRYPT_API_H
   #include <beecrypt/api.h>
   #endif
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/sha224.c
  ============================================================================
  $ cvs diff -u -r1.3 -r1.4 sha224.c
  --- rpm/rpmio/sha224.c	24 Jun 2007 10:27:21 -0000	1.3
  +++ rpm/rpmio/sha224.c	16 Jul 2007 09:14:57 -0000	1.4
  @@ -25,14 +25,14 @@
    
   #define BEECRYPT_DLL_EXPORT
   
  -#if HAVE_CONFIG_H
  +#ifdef HAVE_CONFIG_H
   # include "config.h"
   #endif
   
   #include "sha224.h"
   #include <beecrypt/sha256.h>
   
  -#if HAVE_ENDIAN_H && HAVE_ASM_BYTEORDER_H
  +#if defined(HAVE_ENDIAN_H) && defined(HAVE_ASM_BYTEORDER_H)
   # include <endian.h>
   #endif
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/system.h
  ============================================================================
  $ cvs diff -u -r2.67 -r2.68 system.h
  --- rpm/system.h	12 Jul 2007 10:57:49 -0000	2.67
  +++ rpm/system.h	16 Jul 2007 09:14:56 -0000	2.68
  @@ -62,7 +62,7 @@
   # include <sys/time.h>
   # include <time.h>
   #else
  -# if HAVE_SYS_TIME_H
  +# ifdef HAVE_SYS_TIME_H
   #  include <sys/time.h>
   # else
   #  include <time.h>
  @@ -98,7 +98,7 @@
   #endif
   
   #ifdef HAVE_STRING_H
  -# if !STDC_HEADERS && HAVE_MEMORY_H
  +# if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
   #  include <memory.h>
   # endif
   # include <string.h>
  @@ -131,12 +131,12 @@
   	/*@modifies fileSystem @*/;
   /*@=declundef @*/
   #else
  -#if HAVE_ERROR && HAVE_ERROR_H
  +#if defined(HAVE_ERROR) && defined(HAVE_ERROR_H)
   #include <error.h>
   #endif
   #endif
   
  -#if HAVE___SECURE_GETENV && !defined(__LCLINT__)
  +#if defined(HAVE___SECURE_GETENV) && !defined(__LCLINT__)
   #define	getenv(_s)	__secure_getenv(_s)
   #endif
   
  @@ -158,7 +158,7 @@
   #endif
   #else /* not STDC_HEADERS */
   char *getenv (const char *name);
  -#if ! HAVE_REALPATH
  +#if !defined(HAVE_REALPATH)
   char *realpath(const char *path, char resolved_path []);
   #endif
   #endif /* STDC_HEADERS */
  @@ -256,46 +256,46 @@
   
   #endif
   
  -#if HAVE_SYS_MMAN_H && !defined(__LCLINT__)
  +#if defined(HAVE_SYS_MMAN_H) && !defined(__LCLINT__)
   #include <sys/mman.h>
   #endif
   
   /* XXX FIXME: popt on sunos4.1.3: <sys/resource.h> requires <sys/time.h> */
  -#if HAVE_SYS_RESOURCE_H && HAVE_SYS_TIME_H
  +#if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_SYS_TIME_H)
   #include <sys/resource.h>
   #endif
   
  -#if HAVE_SYS_UTSNAME_H
  +#if defined(HAVE_SYS_UTSNAME_H)
   #include <sys/utsname.h>
   #endif
   
  -#if HAVE_SYS_WAIT_H
  +#if defined(HAVE_SYS_WAIT_H)
   #include <sys/wait.h>
   #endif
   
  -#if HAVE_GETOPT_H
  +#if defined(HAVE_GETOPT_H)
   /*@-noparams@*/
   #include <getopt.h>
   /*@=noparams@*/
   #endif
   
  -#if HAVE_GRP_H
  +#if defined(HAVE_GRP_H)
   #include <grp.h>
   #endif
   
  -#if HAVE_LIMITS_H
  +#if defined(HAVE_LIMITS_H)
   #include <limits.h>
   #endif
   
  -#if HAVE_ERR_H
  +#if defined(HAVE_ERR_H)
   #include <err.h>
   #endif
   
  -#if HAVE_LIBGEN_H
  +#if defined(HAVE_LIBGEN_H)
   #include <libgen.h>
   #endif
   
  -#if WITH_SELINUX
  +#if defined(WITH_SELINUX)
   #include <selinux/selinux.h>
   #else
   typedef	char * security_context_t;
  @@ -396,7 +396,7 @@
   /*@unused@*/ /*@exits@*/ /*@only@*/ void * vmefail(size_t size)
   	/*@*/;
   
  -#if HAVE_MCHECK_H
  +#if defined(HAVE_MCHECK_H)
   #include <mcheck.h>
   #if defined(__LCLINT__)
   /*@-declundef -incondefs @*/ /* LCL: missing annotations */
  @@ -457,20 +457,20 @@
   /*@unchecked@*/
   extern const char *__progname;
   
  -#if HAVE_NETDB_H
  +#if defined(HAVE_NETDB_H)
   #include <netdb.h>
   #endif
   
  -#if HAVE_PWD_H
  +#if defined(HAVE_PWD_H)
   #include <pwd.h>
   #endif
   
   /* Take care of NLS matters.  */
   
  -#if HAVE_LOCALE_H
  +#if defined(HAVE_LOCALE_H)
   # include <locale.h>
   #endif
  -#if !HAVE_SETLOCALE
  +#if !defined(HAVE_SETLOCALE)
   # define setlocale(Category, Locale) /* empty */
   #endif
   
  @@ -601,15 +601,15 @@
   /*@=declundef =incondefs @*/
   #endif
   
  -#if ! HAVE_S_IFSOCK
  +#if !defined(HAVE_S_IFSOCK)
   #define S_IFSOCK (0xc000)
   #endif
   
  -#if ! HAVE_S_ISLNK
  +#if !defined(HAVE_S_ISLNK)
   #define S_ISLNK(mode) ((mode & 0xf000) == S_IFLNK)
   #endif
   
  -#if ! HAVE_S_ISSOCK
  +#if !defined(HAVE_S_ISSOCK)
   #define S_ISSOCK(mode) ((mode & 0xf000) == S_IFSOCK)
   #endif
   
  @@ -622,52 +622,52 @@
   extern void *myrealloc(void *, size_t);
   #endif
   
  -#if ! HAVE_SETENV
  +#if !defined(HAVE_SETENV)
   extern int setenv(const char *name, const char *value, int replace);
   extern void unsetenv(const char *name);
   #endif
   
  -#if HAVE_SYS_SOCKET_H
  +#if defined(HAVE_SYS_SOCKET_H)
   #include <sys/types.h>
   #include <sys/socket.h>
   #endif
   
  -#if HAVE_POLL_H
  +#if defined(HAVE_POLL_H)
   #include <poll.h>
   #else
  -#if HAVE_SYS_SELECT_H && !defined(__LCLINT__)
  +#if defined(HAVE_SYS_SELECT_H) && !defined(__LCLINT__)
   #include <sys/select.h>
   #endif
   #endif
   
   /* Solaris <= 2.6 limits getpass return to only 8 chars */
  -#if HAVE_GETPASSPHRASE
  +#if defined(HAVE_GETPASSPHRASE)
   #define	getpass	getpassphrase
   #endif
   
  -#if ! HAVE_LCHOWN
  +#if !defined(HAVE_LCHOWN)
   #define lchown chown
   #endif
   
  -#if HAVE_GETMNTINFO || HAVE_GETMNTINFO_R || HAVE_MNTCTL
  +#if defined(HAVE_GETMNTINFO) || defined(HAVE_GETMNTINFO_R) || defined(HAVE_MNTCTL)
   # define GETMNTENT_ONE 0
   # define GETMNTENT_TWO 0
  -# if HAVE_SYS_MNTCTL_H
  +# if defined(HAVE_SYS_MNTCTL_H)
   #  include <sys/mntctl.h>
   # endif
  -# if HAVE_SYS_VMOUNT_H
  +# if defined(HAVE_SYS_VMOUNT_H)
   #  include <sys/vmount.h>
   # endif
  -# if HAVE_SYS_MOUNT_H
  +# if defined(HAVE_SYS_MOUNT_H)
   #  include <sys/mount.h>
   # endif
  -#elif HAVE_MNTENT_H || !(HAVE_GETMNTENT) || HAVE_STRUCT_MNTTAB
  -# if HAVE_MNTENT_H
  +#elif defined(HAVE_MNTENT_H) || !defined(HAVE_GETMNTENT) || defined(HAVE_STRUCT_MNTTAB)
  +# if defined(HAVE_MNTENT_H)
   #  include <stdio.h>
   #  include <mntent.h>
   #  define our_mntent struct mntent
   #  define our_mntdir mnt_dir
  -# elif HAVE_STRUCT_MNTTAB
  +# elif defined(HAVE_STRUCT_MNTTAB)
   #  include <stdio.h>
   #  include <mnttab.h>
      struct our_mntent {
  @@ -685,7 +685,7 @@
   # endif
   # define GETMNTENT_ONE 1
   # define GETMNTENT_TWO 0
  -#elif HAVE_SYS_MNTTAB_H
  +#elif defined(HAVE_SYS_MNTTAB_H)
   # include <stdio.h>
   # include <sys/mnttab.h>
   # define GETMNTENT_ONE 0
  @@ .
Received on Mon Jul 16 11:14:57 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.