+2007-01-29 Bruno Haible <bruno@clisp.org>
+
+ * lib/allocsa.h: Use '#if HAVE_*' instead of '#ifdef HAVE_*'.
+ * lib/execute.c: Likewise.
+ * lib/pipe.c: Likewise.
+ * lib/printf-args.h: Likewise.
+ * lib/printf-args.c: Likewise.
+ * lib/printf-parse.c: Likewise.
+ * lib/vasnprintf.c: Likewise.
+
2007-01-29 Eric Blake <ebb9@byu.net>
* lib/memrchr.c: Assume <string.h> unconditionally, to pull in
/* Safe automatic memory allocation.
- Copyright (C) 2003-2006 Free Software Foundation, Inc.
+ Copyright (C) 2003-2007 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2003.
This program is free software; you can redistribute it and/or modify
among all elementary types. */
sa_alignment_long = sa_alignof (long),
sa_alignment_double = sa_alignof (double),
-#ifdef HAVE_LONG_LONG_INT
+#if HAVE_LONG_LONG_INT
sa_alignment_longlong = sa_alignof (long long),
#endif
-#ifdef HAVE_LONG_DOUBLE
+#if HAVE_LONG_DOUBLE
sa_alignment_longdouble = sa_alignof (long double),
#endif
sa_alignment_max = ((sa_alignment_long - 1) | (sa_alignment_double - 1)
-#ifdef HAVE_LONG_LONG_INT
+#if HAVE_LONG_LONG_INT
| (sa_alignment_longlong - 1)
#endif
-#ifdef HAVE_LONG_DOUBLE
+#if HAVE_LONG_DOUBLE
| (sa_alignment_longdouble - 1)
#endif
) + 1,
/* Creation of autonomous subprocesses.
- Copyright (C) 2001-2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2001-2004, 2006-2007 Free Software Foundation, Inc.
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
This program is free software; you can redistribute it and/or modify
#else
/* Unix API. */
-# ifdef HAVE_POSIX_SPAWN
+# if HAVE_POSIX_SPAWN
# include <spawn.h>
# else
-# ifdef HAVE_VFORK_H
+# if HAVE_VFORK_H
# include <vfork.h>
# endif
# endif
#endif
-#ifndef HAVE_ENVIRON_DECL
+#if ! HAVE_ENVIRON_DECL
extern char **environ;
#endif
/* Creation of subprocesses, communicating via pipes.
- Copyright (C) 2001-2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2001-2004, 2006-2007 Free Software Foundation, Inc.
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
This program is free software; you can redistribute it and/or modify
#else
/* Unix API. */
-# ifdef HAVE_POSIX_SPAWN
+# if HAVE_POSIX_SPAWN
# include <spawn.h>
# else
-# ifdef HAVE_VFORK_H
+# if HAVE_VFORK_H
# include <vfork.h>
# endif
# endif
#endif
-#ifndef HAVE_ENVIRON_DECL
+#if ! HAVE_ENVIRON_DECL
extern char **environ;
#endif
/* Decomposed printf argument list.
- Copyright (C) 1999, 2002-2003, 2005-2006 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002-2003, 2005-2007 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
case TYPE_ULONGINT:
ap->a.a_ulongint = va_arg (args, unsigned long int);
break;
-#ifdef HAVE_LONG_LONG_INT
+#if HAVE_LONG_LONG_INT
case TYPE_LONGLONGINT:
ap->a.a_longlongint = va_arg (args, long long int);
break;
case TYPE_DOUBLE:
ap->a.a_double = va_arg (args, double);
break;
-#ifdef HAVE_LONG_DOUBLE
+#if HAVE_LONG_DOUBLE
case TYPE_LONGDOUBLE:
ap->a.a_longdouble = va_arg (args, long double);
break;
case TYPE_CHAR:
ap->a.a_char = va_arg (args, int);
break;
-#ifdef HAVE_WINT_T
+#if HAVE_WINT_T
case TYPE_WIDE_CHAR:
/* Although ISO C 99 7.24.1.(2) says that wint_t is "unchanged by
default argument promotions", this is not the case in mingw32,
if (ap->a.a_string == NULL)
ap->a.a_string = "(NULL)";
break;
-#ifdef HAVE_WCHAR_T
+#if HAVE_WCHAR_T
case TYPE_WIDE_STRING:
ap->a.a_wide_string = va_arg (args, const wchar_t *);
/* A null pointer is an invalid argument for "%ls", but in practice
case TYPE_COUNT_LONGINT_POINTER:
ap->a.a_count_longint_pointer = va_arg (args, long int *);
break;
-#ifdef HAVE_LONG_LONG_INT
+#if HAVE_LONG_LONG_INT
case TYPE_COUNT_LONGLONGINT_POINTER:
ap->a.a_count_longlongint_pointer = va_arg (args, long long int *);
break;
/* Decomposed printf argument list.
- Copyright (C) 1999, 2002-2003, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002-2003, 2006-2007 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <stddef.h>
/* Get wchar_t. */
-#ifdef HAVE_WCHAR_T
+#if HAVE_WCHAR_T
# include <stddef.h>
#endif
/* Get wint_t. */
-#ifdef HAVE_WINT_T
+#if HAVE_WINT_T
# include <wchar.h>
#endif
TYPE_UINT,
TYPE_LONGINT,
TYPE_ULONGINT,
-#ifdef HAVE_LONG_LONG_INT
+#if HAVE_LONG_LONG_INT
TYPE_LONGLONGINT,
TYPE_ULONGLONGINT,
#endif
TYPE_DOUBLE,
-#ifdef HAVE_LONG_DOUBLE
+#if HAVE_LONG_DOUBLE
TYPE_LONGDOUBLE,
#endif
TYPE_CHAR,
-#ifdef HAVE_WINT_T
+#if HAVE_WINT_T
TYPE_WIDE_CHAR,
#endif
TYPE_STRING,
-#ifdef HAVE_WCHAR_T
+#if HAVE_WCHAR_T
TYPE_WIDE_STRING,
#endif
TYPE_POINTER,
TYPE_COUNT_SHORT_POINTER,
TYPE_COUNT_INT_POINTER,
TYPE_COUNT_LONGINT_POINTER
-#ifdef HAVE_LONG_LONG_INT
+#if HAVE_LONG_LONG_INT
, TYPE_COUNT_LONGLONGINT_POINTER
#endif
} arg_type;
unsigned int a_uint;
long int a_longint;
unsigned long int a_ulongint;
-#ifdef HAVE_LONG_LONG_INT
+#if HAVE_LONG_LONG_INT
long long int a_longlongint;
unsigned long long int a_ulonglongint;
#endif
float a_float;
double a_double;
-#ifdef HAVE_LONG_DOUBLE
+#if HAVE_LONG_DOUBLE
long double a_longdouble;
#endif
int a_char;
-#ifdef HAVE_WINT_T
+#if HAVE_WINT_T
wint_t a_wide_char;
#endif
const char* a_string;
-#ifdef HAVE_WCHAR_T
+#if HAVE_WCHAR_T
const wchar_t* a_wide_string;
#endif
void* a_pointer;
short * a_count_short_pointer;
int * a_count_int_pointer;
long int * a_count_longint_pointer;
-#ifdef HAVE_LONG_LONG_INT
+#if HAVE_LONG_LONG_INT
long long int * a_count_longlongint_pointer;
#endif
}
/* Formatted output to strings.
- Copyright (C) 1999-2000, 2002-2003, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1999-2000, 2002-2003, 2006-2007 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
flags += 8;
cp++;
}
-#ifdef HAVE_INTMAX_T
+#if HAVE_INTMAX_T
else if (*cp == 'j')
{
if (sizeof (intmax_t) > sizeof (long))
switch (c)
{
case 'd': case 'i':
-#ifdef HAVE_LONG_LONG_INT
+#if HAVE_LONG_LONG_INT
/* If 'long long' exists and is larger than 'long': */
if (flags >= 16 || (flags & 4))
type = TYPE_LONGLONGINT;
type = TYPE_INT;
break;
case 'o': case 'u': case 'x': case 'X':
-#ifdef HAVE_LONG_LONG_INT
+#if HAVE_LONG_LONG_INT
/* If 'long long' exists and is larger than 'long': */
if (flags >= 16 || (flags & 4))
type = TYPE_ULONGLONGINT;
break;
case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
case 'a': case 'A':
-#ifdef HAVE_LONG_DOUBLE
+#if HAVE_LONG_DOUBLE
if (flags >= 16 || (flags & 4))
type = TYPE_LONGDOUBLE;
else
break;
case 'c':
if (flags >= 8)
-#ifdef HAVE_WINT_T
+#if HAVE_WINT_T
type = TYPE_WIDE_CHAR;
#else
goto error;
else
type = TYPE_CHAR;
break;
-#ifdef HAVE_WINT_T
+#if HAVE_WINT_T
case 'C':
type = TYPE_WIDE_CHAR;
c = 'c';
#endif
case 's':
if (flags >= 8)
-#ifdef HAVE_WCHAR_T
+#if HAVE_WCHAR_T
type = TYPE_WIDE_STRING;
#else
goto error;
else
type = TYPE_STRING;
break;
-#ifdef HAVE_WCHAR_T
+#if HAVE_WCHAR_T
case 'S':
type = TYPE_WIDE_STRING;
c = 's';
type = TYPE_POINTER;
break;
case 'n':
-#ifdef HAVE_LONG_LONG_INT
+#if HAVE_LONG_LONG_INT
/* If 'long long' exists and is larger than 'long': */
if (flags >= 16 || (flags & 4))
type = TYPE_COUNT_LONGLONGINT_POINTER;
/* vsprintf with automatic memory allocation.
- Copyright (C) 1999, 2002-2006 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002-2007 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
/* Checked size_t computations. */
#include "xsize.h"
-#ifdef HAVE_WCHAR_T
-# ifdef HAVE_WCSLEN
+#if HAVE_WCHAR_T
+# if HAVE_WCSLEN
# define local_wcslen wcslen
# else
/* Solaris 2.5.1 has wcslen() in a separate library libw.so. To avoid
case TYPE_COUNT_LONGINT_POINTER:
*a.arg[dp->arg_index].a.a_count_longint_pointer = length;
break;
-#ifdef HAVE_LONG_LONG_INT
+#if HAVE_LONG_LONG_INT
case TYPE_COUNT_LONGLONGINT_POINTER:
*a.arg[dp->arg_index].a.a_count_longlongint_pointer = length;
break;
{
case 'd': case 'i': case 'u':
-# ifdef HAVE_LONG_LONG_INT
+# if HAVE_LONG_LONG_INT
if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
tmp_length =
(unsigned int) (sizeof (unsigned long long) * CHAR_BIT
break;
case 'o':
-# ifdef HAVE_LONG_LONG_INT
+# if HAVE_LONG_LONG_INT
if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
tmp_length =
(unsigned int) (sizeof (unsigned long long) * CHAR_BIT
break;
case 'x': case 'X':
-# ifdef HAVE_LONG_LONG_INT
+# if HAVE_LONG_LONG_INT
if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
tmp_length =
(unsigned int) (sizeof (unsigned long long) * CHAR_BIT
break;
case 'f': case 'F':
-# ifdef HAVE_LONG_DOUBLE
+# if HAVE_LONG_DOUBLE
if (type == TYPE_LONGDOUBLE)
tmp_length =
(unsigned int) (LDBL_MAX_EXP
break;
case 'c':
-# if defined HAVE_WINT_T && !WIDE_CHAR_VERSION
+# if HAVE_WINT_T && !WIDE_CHAR_VERSION
if (type == TYPE_WIDE_CHAR)
tmp_length = MB_CUR_MAX;
else
break;
case 's':
-# ifdef HAVE_WCHAR_T
+# if HAVE_WCHAR_T
if (type == TYPE_WIDE_STRING)
{
tmp_length =
switch (type)
{
-#ifdef HAVE_LONG_LONG_INT
+#if HAVE_LONG_LONG_INT
case TYPE_LONGLONGINT:
case TYPE_ULONGLONGINT:
*p++ = 'l';
#endif
case TYPE_LONGINT:
case TYPE_ULONGINT:
-#ifdef HAVE_WINT_T
+#if HAVE_WINT_T
case TYPE_WIDE_CHAR:
#endif
-#ifdef HAVE_WCHAR_T
+#if HAVE_WCHAR_T
case TYPE_WIDE_STRING:
#endif
*p++ = 'l';
break;
-#ifdef HAVE_LONG_DOUBLE
+#if HAVE_LONG_DOUBLE
case TYPE_LONGDOUBLE:
*p++ = 'L';
break;
SNPRINTF_BUF (arg);
}
break;
-#ifdef HAVE_LONG_LONG_INT
+#if HAVE_LONG_LONG_INT
case TYPE_LONGLONGINT:
{
long long int arg = a.arg[dp->arg_index].a.a_longlongint;
SNPRINTF_BUF (arg);
}
break;
-#ifdef HAVE_LONG_DOUBLE
+#if HAVE_LONG_DOUBLE
case TYPE_LONGDOUBLE:
{
long double arg = a.arg[dp->arg_index].a.a_longdouble;
SNPRINTF_BUF (arg);
}
break;
-#ifdef HAVE_WINT_T
+#if HAVE_WINT_T
case TYPE_WIDE_CHAR:
{
wint_t arg = a.arg[dp->arg_index].a.a_wide_char;
SNPRINTF_BUF (arg);
}
break;
-#ifdef HAVE_WCHAR_T
+#if HAVE_WCHAR_T
case TYPE_WIDE_STRING:
{
const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string;