summaryrefslogtreecommitdiff
path: root/gl/lib/mbsalign.c
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2010-10-01 14:28:18 +0100
committerPádraig Brady <P@draigBrady.com>2010-10-01 16:30:31 +0100
commit288bfea72cfb645e1635e6ae62e4cd2aac57e826 (patch)
treecc91a5465d40c087e30b3fe383f11521287dc770 /gl/lib/mbsalign.c
parent6067d0522888ec279d3fa3f1128892fa2d32c8fb (diff)
downloadcoreutils-288bfea72cfb645e1635e6ae62e4cd2aac57e826.tar.xz
maint: ensure the mbsalign module is C89 compatible
This module may be moved to gnulib at some stage, so keep it C89 compatible. * gl/lib/mbsalign.c (mbsalign): Declare variables at start of scope (ambsalign): Likewise * gl/lib/mbsalign.h: Remove trailing comma from enum Reported by Andrei Suhan
Diffstat (limited to 'gl/lib/mbsalign.c')
-rw-r--r--gl/lib/mbsalign.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gl/lib/mbsalign.c b/gl/lib/mbsalign.c
index b92fe8f79..117e4bf3a 100644
--- a/gl/lib/mbsalign.c
+++ b/gl/lib/mbsalign.c
@@ -217,7 +217,7 @@ mbsalign_unibyte:
/* Write as much NUL terminated output to DEST as possible. */
if (dest_size != 0)
{
- size_t start_spaces, end_spaces;
+ size_t start_spaces, end_spaces, space_left;
char *dest_end = dest + dest_size - 1;
switch (align)
@@ -238,7 +238,7 @@ mbsalign_unibyte:
}
dest = mbs_align_pad (dest, dest_end, start_spaces);
- size_t space_left = dest_end - dest;
+ space_left = dest_end - dest;
dest = mempcpy (dest, str_to_print, MIN (n_used_bytes, space_left));
mbs_align_pad (dest, dest_end, end_spaces);
}
@@ -265,8 +265,9 @@ ambsalign (const char *src, size_t *width, mbs_align_t align, int flags)
while (req >= size)
{
+ char *nbuf;
size = req + 1; /* Space for NUL. */
- char *nbuf = realloc (buf, size);
+ nbuf = realloc (buf, size);
if (nbuf == NULL)
{
free (buf);