1 #if !defined(lint) && !defined(DOS)
2 static char rcsid
[] = "$Id: utf8stub.c 769 2007-10-24 00:15:40Z hubert@u.washington.edu $";
6 * ========================================================================
7 * Copyright 2006-2007 University of Washington
8 * Copyright 2013-2018 Eduardo Chappa
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * ========================================================================
25 * Stub functions to fill in functions used in utf8 support routines
32 void *block
= malloc (size
? size
: (size_t) 1);
33 if (!block
) fatal ("Out of memory");
39 fs_resize(void **block
, size_t size
)
41 if (!(*block
= realloc (*block
,size
? size
: (size_t) 1)))
42 fatal ("Can't resize memory");
46 fs_give (void **block
)
60 compare_ulong(unsigned long l1
, unsigned long l2
)
62 if (l1
< l2
) return -1;
63 if (l1
> l2
) return 1;
69 compare_cstring(unsigned char *s1
, unsigned char *s2
)
72 if (!s1
) return s2
? -1 : 0; /* empty string cases */
73 else if (!s2
) return 1;
74 for (; *s1
&& *s2
; s1
++,s2
++)
75 if ((i
= (compare_ulong (islower (*s1
) ? toupper (*s1
) : *s1
,
76 islower (*s2
) ? toupper (*s2
) : *s2
))) != 0)
77 return i
; /* found a difference */
78 if (*s1
) return 1; /* first string is longer */
79 return *s2
? -1 : 0; /* second string longer : strings identical */