summaryrefslogtreecommitdiff
path: root/lib/uniwbrk/u8-wordbreaks.c
diff options
context:
space:
mode:
authorAndreas Rottmann <a.rottmann@gmx.at>2010-05-27 18:23:17 +0200
committerAndreas Rottmann <a.rottmann@gmx.at>2010-05-27 18:23:17 +0200
commitbd6adfa17d453e4c486e36fed4c5779db90a8a0e (patch)
tree9798677560d5f99061afe9f0db105a8c97f2438a /lib/uniwbrk/u8-wordbreaks.c
parent79ca645d222db2e158784642c3b464a47bea26f3 (diff)
parent3e0814cd9862b89c7a39672672937477bd87ddfb (diff)
Merge commit 'upstream/0.9.3'
Diffstat (limited to 'lib/uniwbrk/u8-wordbreaks.c')
-rw-r--r--lib/uniwbrk/u8-wordbreaks.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/lib/uniwbrk/u8-wordbreaks.c b/lib/uniwbrk/u8-wordbreaks.c
index 59d2076d..c7edfe9e 100644
--- a/lib/uniwbrk/u8-wordbreaks.c
+++ b/lib/uniwbrk/u8-wordbreaks.c
@@ -1,5 +1,5 @@
/* Word breaks in UTF-8 strings.
- Copyright (C) 2009 Free Software Foundation, Inc.
+ Copyright (C) 2009-2010 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2009.
This program is free software: you can redistribute it and/or modify it
@@ -50,28 +50,28 @@ read_file (FILE *stream)
while (! feof (stream))
{
if (size + BUFSIZE > alloc)
- {
- alloc = alloc + alloc / 2;
- if (alloc < size + BUFSIZE)
- alloc = size + BUFSIZE;
- buf = realloc (buf, alloc);
- if (buf == NULL)
- {
- fprintf (stderr, "out of memory\n");
- exit (1);
- }
- }
+ {
+ alloc = alloc + alloc / 2;
+ if (alloc < size + BUFSIZE)
+ alloc = size + BUFSIZE;
+ buf = realloc (buf, alloc);
+ if (buf == NULL)
+ {
+ fprintf (stderr, "out of memory\n");
+ exit (1);
+ }
+ }
count = fread (buf + size, 1, BUFSIZE, stream);
if (count == 0)
- {
- if (ferror (stream))
- {
- perror ("fread");
- exit (1);
- }
- }
+ {
+ if (ferror (stream))
+ {
+ perror ("fread");
+ exit (1);
+ }
+ }
else
- size += count;
+ size += count;
}
buf = realloc (buf, size + 1);
if (buf == NULL)
@@ -98,20 +98,20 @@ main (int argc, char * argv[])
u8_wordbreaks ((uint8_t *) input, length, breaks);
for (i = 0; i < length; i++)
- {
- switch (breaks[i])
- {
- case 1:
- /* U+2027 in UTF-8 encoding */
- putc (0xe2, stdout); putc (0x80, stdout); putc (0xa7, stdout);
- break;
- case 0:
- break;
- default:
- abort ();
- }
- putc (input[i], stdout);
- }
+ {
+ switch (breaks[i])
+ {
+ case 1:
+ /* U+2027 in UTF-8 encoding */
+ putc (0xe2, stdout); putc (0x80, stdout); putc (0xa7, stdout);
+ break;
+ case 0:
+ break;
+ default:
+ abort ();
+ }
+ putc (input[i], stdout);
+ }
free (breaks);