+2003-11-23 Bruno Haible <bruno@clisp.org>
+
+ * PACKAGING: Remove ssize_t.m4.
+
2003-11-16 Bruno Haible <bruno@clisp.org>
* PACKAGING: Add size_max.m4, ssize_t.m4, xsize.m4.
$prefix/share/aclocal/progtest.m4
$prefix/share/aclocal/signed.m4
$prefix/share/aclocal/size_max.m4
- $prefix/share/aclocal/ssize_t.m4
$prefix/share/aclocal/stdint_h.m4
$prefix/share/aclocal/uintmax_t.m4
$prefix/share/aclocal/ulonglong.m4
+2003-11-23 Paul Eggert <eggert@twinsun.com>
+ Bruno Haible <bruno@clisp.org>
+
+ * printf-parse.h: Don't include sys/types.h.
+ (ARG_NONE): New macro.
+ (char_directive): Change type of *arg_index fields to size_t.
+ * wprintf-parse.h: Don't include sys/types.h.
+ (ARG_NONE): New macro.
+ (wchar_t_directive): Change type of *arg_index fields to size_t.
+ * printf-parse.c: Don't include sys/types.h.
+ (SSIZE_MAX): Remove macro.
+ (PRINTF_PARSE): Change the type of the arg_index variables to size_t.
+ Remove unnecessary overflow check.
+ * vasnprintf.c (VASNPRINTF): Update for type change of *arg_index
+ fields.
+
2003-11-17 Bruno Haible <bruno@clisp.org>
* vasnprintf.c (alloca): Remove fallback definition.
/* Get size_t, NULL. */
#include <stddef.h>
-/* Get ssize_t. */
-#include <sys/types.h>
-
/* Get intmax_t. */
#if HAVE_STDINT_H_WITH_UINTMAX
# include <stdint.h>
/* Checked size_t computations. */
#include "xsize.h"
-#ifndef SSIZE_MAX
-# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
-#endif
-
#if WIDE_CHAR_VERSION
# define PRINTF_PARSE wprintf_parse
# define CHAR_T wchar_t
PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
{
const CHAR_T *cp = format; /* pointer into format */
- ssize_t arg_posn = 0; /* number of regular arguments consumed */
+ size_t arg_posn = 0; /* number of regular arguments consumed */
size_t d_allocated; /* allocated elements of d->dir */
size_t a_allocated; /* allocated elements of a->arg */
size_t max_width_length = 0;
CHAR_T c = *cp++;
if (c == '%')
{
- ssize_t arg_index = -1;
+ size_t arg_index = ARG_NONE;
DIRECTIVE *dp = &d->dir[d->count];/* pointer to next directive */
/* Initialize the next directive. */
dp->flags = 0;
dp->width_start = NULL;
dp->width_end = NULL;
- dp->width_arg_index = -1;
+ dp->width_arg_index = ARG_NONE;
dp->precision_start = NULL;
dp->precision_end = NULL;
- dp->precision_arg_index = -1;
- dp->arg_index = -1;
+ dp->precision_arg_index = ARG_NONE;
+ dp->arg_index = ARG_NONE;
/* Test for positional argument. */
if (*cp >= '0' && *cp <= '9')
if (n == 0)
/* Positional argument 0. */
goto error;
- if (size_overflow_p (n) || n - 1 > SSIZE_MAX)
+ if (size_overflow_p (n))
/* n too large, would lead to out of memory later. */
goto error;
arg_index = n - 1;
if (n == 0)
/* Positional argument 0. */
goto error;
- if (size_overflow_p (n) || n - 1 > SSIZE_MAX)
+ if (size_overflow_p (n))
/* n too large, would lead to out of memory later. */
goto error;
dp->width_arg_index = n - 1;
cp = np + 1;
}
}
- if (dp->width_arg_index < 0)
+ if (dp->width_arg_index == ARG_NONE)
{
dp->width_arg_index = arg_posn++;
- if (dp->width_arg_index < 0)
- /* arg_posn wrapped around at SSIZE_MAX. */
+ if (dp->width_arg_index == ARG_NONE)
+ /* arg_posn wrapped around. */
goto error;
}
REGISTER_ARG (dp->width_arg_index, TYPE_INT);
if (n == 0)
/* Positional argument 0. */
goto error;
- if (size_overflow_p (n) || n - 1 > SSIZE_MAX)
+ if (size_overflow_p (n))
/* n too large, would lead to out of memory
later. */
goto error;
cp = np + 1;
}
}
- if (dp->precision_arg_index < 0)
+ if (dp->precision_arg_index == ARG_NONE)
{
dp->precision_arg_index = arg_posn++;
- if (dp->precision_arg_index < 0)
- /* arg_posn wrapped around at SSIZE_MAX. */
+ if (dp->precision_arg_index == ARG_NONE)
+ /* arg_posn wrapped around. */
goto error;
}
REGISTER_ARG (dp->precision_arg_index, TYPE_INT);
if (type != TYPE_NONE)
{
dp->arg_index = arg_index;
- if (dp->arg_index < 0)
+ if (dp->arg_index == ARG_NONE)
{
dp->arg_index = arg_posn++;
- if (dp->arg_index < 0)
- /* arg_posn wrapped around at SSIZE_MAX. */
+ if (dp->arg_index == ARG_NONE)
+ /* arg_posn wrapped around. */
goto error;
}
REGISTER_ARG (dp->arg_index, type);
DIRECTIVE *memory;
d_allocated = xtimes (d_allocated, 2);
- if (size_overflow_p (d_allocated))
- /* Overflow, would lead to out of memory. */
- goto error;
memory_size = xtimes (d_allocated, sizeof (DIRECTIVE));
if (size_overflow_p (memory_size))
/* Overflow, would lead to out of memory. */
#include "printf-args.h"
-/* Get ssize_t. */
-#include <sys/types.h>
-
/* Flags */
#define FLAG_GROUP 1 /* ' flag */
#define FLAG_ALT 16 /* # flag */
#define FLAG_ZERO 32
+/* arg_index value indicating that no argument is consumed. */
+#define ARG_NONE (~(size_t)0)
+
/* A parsed directive. */
typedef struct
{
int flags;
const char* width_start;
const char* width_end;
- ssize_t width_arg_index;
+ size_t width_arg_index;
const char* precision_start;
const char* precision_end;
- ssize_t precision_arg_index;
+ size_t precision_arg_index;
char conversion; /* d i o u x X f e E g G c s p n U % but not C S */
- ssize_t arg_index;
+ size_t arg_index;
}
char_directive;
{
size_t augmented_length;
- if (!(dp->arg_index < 0))
+ if (!(dp->arg_index == ARG_NONE))
abort ();
augmented_length = xsum (length, 1);
ENSURE_ALLOCATION (augmented_length);
}
else
{
- if (!(dp->arg_index >= 0))
+ if (!(dp->arg_index != ARG_NONE))
abort ();
if (dp->conversion == 'n')
width = 0;
if (dp->width_start != dp->width_end)
{
- if (dp->width_arg_index >= 0)
+ if (dp->width_arg_index != ARG_NONE)
{
int arg;
precision = 6;
if (dp->precision_start != dp->precision_end)
{
- if (dp->precision_arg_index >= 0)
+ if (dp->precision_arg_index != ARG_NONE)
{
int arg;
/* Construct the arguments for calling snprintf or sprintf. */
prefix_count = 0;
- if (dp->width_arg_index >= 0)
+ if (dp->width_arg_index != ARG_NONE)
{
if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
abort ();
prefixes[prefix_count++] = a.arg[dp->width_arg_index].a.a_int;
}
- if (dp->precision_arg_index >= 0)
+ if (dp->precision_arg_index != ARG_NONE)
{
if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
abort ();
#include "printf-args.h"
-/* Get ssize_t. */
-#include <sys/types.h>
-
/* Flags */
#define FLAG_GROUP 1 /* ' flag */
#define FLAG_ALT 16 /* # flag */
#define FLAG_ZERO 32
+/* arg_index value indicating that no argument is consumed. */
+#define ARG_NONE (~(size_t)0)
+
/* A parsed directive. */
typedef struct
{
int flags;
const wchar_t* width_start;
const wchar_t* width_end;
- ssize_t width_arg_index;
+ size_t width_arg_index;
const wchar_t* precision_start;
const wchar_t* precision_end;
- ssize_t precision_arg_index;
+ size_t precision_arg_index;
wchar_t conversion; /* d i o u x X f e E g G c s p n U % but not C S */
- ssize_t arg_index;
+ size_t arg_index;
}
wchar_t_directive;
+2003-11-23 Paul Eggert <eggert@twinsun.com>
+ Bruno Haible <bruno@clisp.org>
+
+ * printf-parse.h: Don't include sys/types.h.
+ (ARG_NONE): New macro.
+ (char_directive): Change type of *arg_index fields to size_t.
+ * printf-parse.c: Don't include sys/types.h.
+ (SSIZE_MAX): Remove macro.
+ (PRINTF_PARSE): Change the type of the arg_index variables to size_t.
+ Remove unnecessary overflow check.
+ * vasnprintf.c (VASNPRINTF): Update for type change of *arg_index
+ fields.
+ * configure.ac: Don't invoke gt_TYPE_SSIZE_T.
+
2003-11-19 Bruno Haible <bruno@clisp.org>
* configure.ac: Better test for ptrdiff_t. Invoke gt_TYPE_SSIZE_T and
[Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
])
gt_TYPE_INTMAX_T
-gt_TYPE_SSIZE_T
gl_XSIZE
dnl Checks for library functions.
/* Get size_t, NULL. */
#include <stddef.h>
-/* Get ssize_t. */
-#include <sys/types.h>
-
/* Get intmax_t. */
#if HAVE_STDINT_H_WITH_UINTMAX
# include <stdint.h>
/* Checked size_t computations. */
#include "xsize.h"
-#ifndef SSIZE_MAX
-# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
-#endif
-
#if WIDE_CHAR_VERSION
# define PRINTF_PARSE wprintf_parse
# define CHAR_T wchar_t
PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
{
const CHAR_T *cp = format; /* pointer into format */
- ssize_t arg_posn = 0; /* number of regular arguments consumed */
+ size_t arg_posn = 0; /* number of regular arguments consumed */
size_t d_allocated; /* allocated elements of d->dir */
size_t a_allocated; /* allocated elements of a->arg */
size_t max_width_length = 0;
CHAR_T c = *cp++;
if (c == '%')
{
- ssize_t arg_index = -1;
+ size_t arg_index = ARG_NONE;
DIRECTIVE *dp = &d->dir[d->count];/* pointer to next directive */
/* Initialize the next directive. */
dp->flags = 0;
dp->width_start = NULL;
dp->width_end = NULL;
- dp->width_arg_index = -1;
+ dp->width_arg_index = ARG_NONE;
dp->precision_start = NULL;
dp->precision_end = NULL;
- dp->precision_arg_index = -1;
- dp->arg_index = -1;
+ dp->precision_arg_index = ARG_NONE;
+ dp->arg_index = ARG_NONE;
/* Test for positional argument. */
if (*cp >= '0' && *cp <= '9')
if (n == 0)
/* Positional argument 0. */
goto error;
- if (size_overflow_p (n) || n - 1 > SSIZE_MAX)
+ if (size_overflow_p (n))
/* n too large, would lead to out of memory later. */
goto error;
arg_index = n - 1;
if (n == 0)
/* Positional argument 0. */
goto error;
- if (size_overflow_p (n) || n - 1 > SSIZE_MAX)
+ if (size_overflow_p (n))
/* n too large, would lead to out of memory later. */
goto error;
dp->width_arg_index = n - 1;
cp = np + 1;
}
}
- if (dp->width_arg_index < 0)
+ if (dp->width_arg_index == ARG_NONE)
{
dp->width_arg_index = arg_posn++;
- if (dp->width_arg_index < 0)
- /* arg_posn wrapped around at SSIZE_MAX. */
+ if (dp->width_arg_index == ARG_NONE)
+ /* arg_posn wrapped around. */
goto error;
}
REGISTER_ARG (dp->width_arg_index, TYPE_INT);
if (n == 0)
/* Positional argument 0. */
goto error;
- if (size_overflow_p (n) || n - 1 > SSIZE_MAX)
+ if (size_overflow_p (n))
/* n too large, would lead to out of memory
later. */
goto error;
cp = np + 1;
}
}
- if (dp->precision_arg_index < 0)
+ if (dp->precision_arg_index == ARG_NONE)
{
dp->precision_arg_index = arg_posn++;
- if (dp->precision_arg_index < 0)
- /* arg_posn wrapped around at SSIZE_MAX. */
+ if (dp->precision_arg_index == ARG_NONE)
+ /* arg_posn wrapped around. */
goto error;
}
REGISTER_ARG (dp->precision_arg_index, TYPE_INT);
if (type != TYPE_NONE)
{
dp->arg_index = arg_index;
- if (dp->arg_index < 0)
+ if (dp->arg_index == ARG_NONE)
{
dp->arg_index = arg_posn++;
- if (dp->arg_index < 0)
- /* arg_posn wrapped around at SSIZE_MAX. */
+ if (dp->arg_index == ARG_NONE)
+ /* arg_posn wrapped around. */
goto error;
}
REGISTER_ARG (dp->arg_index, type);
DIRECTIVE *memory;
d_allocated = xtimes (d_allocated, 2);
- if (size_overflow_p (d_allocated))
- /* Overflow, would lead to out of memory. */
- goto error;
memory_size = xtimes (d_allocated, sizeof (DIRECTIVE));
if (size_overflow_p (memory_size))
/* Overflow, would lead to out of memory. */
#include "printf-args.h"
-/* Get ssize_t. */
-#include <sys/types.h>
-
/* Flags */
#define FLAG_GROUP 1 /* ' flag */
#define FLAG_ALT 16 /* # flag */
#define FLAG_ZERO 32
+/* arg_index value indicating that no argument is consumed. */
+#define ARG_NONE (~(size_t)0)
+
/* A parsed directive. */
typedef struct
{
int flags;
const char* width_start;
const char* width_end;
- ssize_t width_arg_index;
+ size_t width_arg_index;
const char* precision_start;
const char* precision_end;
- ssize_t precision_arg_index;
+ size_t precision_arg_index;
char conversion; /* d i o u x X f e E g G c s p n U % but not C S */
- ssize_t arg_index;
+ size_t arg_index;
}
char_directive;
{
size_t augmented_length;
- if (!(dp->arg_index < 0))
+ if (!(dp->arg_index == ARG_NONE))
abort ();
augmented_length = xsum (length, 1);
ENSURE_ALLOCATION (augmented_length);
}
else
{
- if (!(dp->arg_index >= 0))
+ if (!(dp->arg_index != ARG_NONE))
abort ();
if (dp->conversion == 'n')
width = 0;
if (dp->width_start != dp->width_end)
{
- if (dp->width_arg_index >= 0)
+ if (dp->width_arg_index != ARG_NONE)
{
int arg;
precision = 6;
if (dp->precision_start != dp->precision_end)
{
- if (dp->precision_arg_index >= 0)
+ if (dp->precision_arg_index != ARG_NONE)
{
int arg;
/* Construct the arguments for calling snprintf or sprintf. */
prefix_count = 0;
- if (dp->width_arg_index >= 0)
+ if (dp->width_arg_index != ARG_NONE)
{
if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
abort ();
prefixes[prefix_count++] = a.arg[dp->width_arg_index].a.a_int;
}
- if (dp->precision_arg_index >= 0)
+ if (dp->precision_arg_index != ARG_NONE)
{
if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
abort ();
+2003-11-23 Bruno Haible <bruno@clisp.org>
+
+ * ssize_t.m4: Remove file, moved to ../../gettext-tools/m4/.
+ * gettext.m4 (AM_INTL_SUBDIR): Don't require gt_TYPE_SSIZE_T.
+ * Makefile.am (EXTRA_DIST): Remove ssize_t.m4.
+
2003-11-19 Bruno Haible <bruno@clisp.org>
* size_max.m4 (gl_SIZE_MAX): Don't use the _ONCE macros here.
progtest.m4 \
signed.m4 \
size_max.m4 \
-ssize_t.m4 \
stdint_h.m4 \
uintmax_t.m4 \
ulonglong.m4 \
-# gettext.m4 serial 27 (gettext-0.13)
+# gettext.m4 serial 28 (gettext-0.13)
dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl
AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl
AC_REQUIRE([gt_INTTYPES_PRI])dnl
- AC_REQUIRE([gt_TYPE_SSIZE_T])dnl
AC_REQUIRE([gl_XSIZE])dnl
AC_CHECK_TYPE([ptrdiff_t], ,
+2003-11-23 Bruno Haible <bruno@clisp.org>
+
+ * gettext.texi (aclocal): Don't mention ssize_t.m4.
+
2003-11-16 Bruno Haible <bruno@clisp.org>
* gettext.texi (aclocal): Mention size_max.m4, ssize_t.m4, xsize.m4.
@file{lib-ld.m4}, @file{lib-link.m4}, @file{lib-prefix.m4},
@file{longdouble.m4}, @file{longlong.m4}, @file{printf-posix.m4},
@file{progtest.m4}, @file{signed.m4}, @file{size_max.m4},
-@file{ssize_t.m4}, @file{stdint_h.m4}, @file{uintmax_t.m4},
-@file{ulonglong.m4}, @file{wchar_t.m4}, @file{wint_t.m4}, @file{xsize.m4}
+@file{stdint_h.m4}, @file{uintmax_t.m4}, @file{ulonglong.m4},
+@file{wchar_t.m4}, @file{wint_t.m4}, @file{xsize.m4}
from GNU @code{gettext}'s
@file{m4/} directory into a single file. If you have suppressed the
@file{intl/} directory, only @file{gettext.m4}, @file{iconv.m4},
+2003-11-23 Bruno Haible <bruno@clisp.org>
+
+ * ssize_t.m4: New file, moved here from ../../gettext-runtime/m4/.
+ * Makefile.am (aclocal_DATA): Remove ssize_t.m4.
+ (EXTRA_DIST): Add ssize_t.m4.
+
2003-11-16 Bruno Haible <bruno@clisp.org>
* size_max.m4: Remove file, moved to ../../gettext-runtime/m4/.
../../gettext-runtime/m4/progtest.m4 \
../../gettext-runtime/m4/signed.m4 \
../../gettext-runtime/m4/size_max.m4 \
- ../../gettext-runtime/m4/ssize_t.m4 \
../../gettext-runtime/m4/stdint_h.m4 \
../../gettext-runtime/m4/uintmax_t.m4 \
../../gettext-runtime/m4/ulonglong.m4 \
sig_atomic_t.m4 \
siginfo.m4 \
signalblocking.m4 \
+ssize_t.m4 \
stdbool.m4 \
strerror.m4 \
strerror_r.m4 \
+2003-11-23 Bruno Haible <bruno@clisp.org>
+
+ * gettextize.in (m4filelist): Remove ssize_t.m4.
+
2003-11-16 Bruno Haible <bruno@clisp.org>
* gettextize.in (m4filelist): Add size_max.m4, ssize_t.m4, xsize.m4.
m4filelist=' codeset.m4 gettext.m4 glibc21.m4 iconv.m4 intdiv0.m4 intmax.m4
inttypes.m4 inttypes_h.m4 inttypes-pri.m4 isc-posix.m4 lcmessage.m4 lib-ld.m4
lib-link.m4 lib-prefix.m4 longdouble.m4 longlong.m4 nls.m4 po.m4
- printf-posix.m4 progtest.m4 signed.m4 size_max.m4 ssize_t.m4 stdint_h.m4
- uintmax_t.m4 ulonglong.m4 wchar_t.m4 wint_t.m4 xsize.m4'
+ printf-posix.m4 progtest.m4 signed.m4 size_max.m4 stdint_h.m4 uintmax_t.m4
+ ulonglong.m4 wchar_t.m4 wint_t.m4 xsize.m4'
# We cannot omit codeset.m4, glibc21.m4, intdiv0.m4, intmax.m4, inttypes.m4,
# inttypes_h.m4, inttypes-pri.m4, isc-posix.m4, lcmessage.m4, longdouble.m4,
# longlong.m4, nls.m4, po.m4, printf-posix.m4, signed.m4, size_max.m4,
-# ssize_t.m4, stdint_h.m4, uintmax_t.m4, ulonglong.m4, wchar_t.m4, wint_t.m4,
-# xsize.m4
+# stdint_h.m4, uintmax_t.m4, ulonglong.m4, wchar_t.m4, wint_t.m4, xsize.m4
# if test -z "$intldir", otherwise "aclocal -I m4" might give an error.
# (aclocal doesn't know which macros are really needed, it looks which macros
# are potentially needed.)