/* Casefolding mapping for UTF-8 strings (locale dependent).
- Copyright (C) 2009 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
/* Specification. */
#include "unicase.h"
-#include <errno.h>
-#include <stddef.h>
-#include <stdlib.h>
-
-#include "unicasemap.h"
-#include "special-casing.h"
-#include "casefold.h"
-
#define FUNC u8_casefold
#define UNIT uint8_t
-#define U_CASEMAP u8_casemap
-#define U_NORMALIZE u8_normalize
+#define U_CT_CASEFOLD u8_ct_casefold
#include "u-casefold.h"
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)
int length = strlen (input);
size_t output_length;
uint8_t *output =
- u8_casefold ((uint8_t *) input, length, uc_locale_language (),
- NULL,
- NULL, &output_length);
+ u8_casefold ((uint8_t *) input, length, uc_locale_language (),
+ NULL,
+ NULL, &output_length);
fwrite (output, 1, output_length, stdout);