Skip to content

Commit

Permalink
Remove unused Unicode functions
Browse files Browse the repository at this point in the history
  • Loading branch information
greghudson committed Dec 26, 2022
1 parent c5507df commit 50b7ae4
Show file tree
Hide file tree
Showing 19 changed files with 7 additions and 5,249 deletions.
29 changes: 0 additions & 29 deletions src/include/k5-unicode.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,41 +87,12 @@

typedef krb5_ucs4 krb5_unicode;

int krb5int_ucstrncmp(
const krb5_unicode *,
const krb5_unicode *,
size_t);

int krb5int_ucstrncasecmp(
const krb5_unicode *,
const krb5_unicode *,
size_t);

krb5_unicode *krb5int_ucstrnchr(
const krb5_unicode *,
size_t,
krb5_unicode);

krb5_unicode *krb5int_ucstrncasechr(
const krb5_unicode *,
size_t,
krb5_unicode);

void krb5int_ucstr2upper(
krb5_unicode *,
size_t);

#define KRB5_UTF8_NOCASEFOLD 0x0U
#define KRB5_UTF8_CASEFOLD 0x1U
#define KRB5_UTF8_ARG1NFC 0x2U
#define KRB5_UTF8_ARG2NFC 0x4U
#define KRB5_UTF8_APPROX 0x8U

krb5_error_code krb5int_utf8_normalize(
const krb5_data *,
krb5_data **,
unsigned);

int krb5int_utf8_normcmp(
const krb5_data *,
const krb5_data *,
Expand Down
74 changes: 0 additions & 74 deletions src/include/k5-utf8.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@
typedef uint16_t krb5_ucs2;
typedef uint32_t krb5_ucs4;

int krb5int_utf8_to_ucs2(const char *p, krb5_ucs2 *out);
size_t krb5int_ucs2_to_utf8(krb5_ucs2 c, char *buf);

int krb5int_utf8_to_ucs4(const char *p, krb5_ucs4 *out);
size_t krb5int_ucs4_to_utf8(krb5_ucs4 c, char *buf);

Expand All @@ -96,49 +93,6 @@ int k5_utf16le_to_utf8(const uint8_t *utf16bytes, size_t nbytes,
int k5_utf8_to_utf16le(const char *utf8, uint8_t **utf16_out,
size_t *nbytes_out);

/* returns the number of bytes in the UTF-8 string */
size_t krb5int_utf8_bytes(const char *);
/* returns the number of UTF-8 characters in the string */
size_t krb5int_utf8_chars(const char *);
/* returns the number of UTF-8 characters in the counted string */
size_t krb5int_utf8c_chars(const char *, size_t);
/* returns the length (in bytes) of the UTF-8 character */
int krb5int_utf8_offset(const char *);
/* returns the length (in bytes) indicated by the UTF-8 character */
int krb5int_utf8_charlen(const char *);

/* returns the length (in bytes) indicated by the UTF-8 character
* also checks that shortest possible encoding was used
*/
int krb5int_utf8_charlen2(const char *);

/* copies a UTF-8 character and returning number of bytes copied */
int krb5int_utf8_copy(char *, const char *);

/* returns pointer of next UTF-8 character in string */
char *krb5int_utf8_next( const char *);
/* returns pointer of previous UTF-8 character in string */
char *krb5int_utf8_prev( const char *);

/* primitive ctype routines -- not aware of non-ascii characters */
int krb5int_utf8_isascii( const char *);
int krb5int_utf8_isalpha( const char *);
int krb5int_utf8_isalnum( const char *);
int krb5int_utf8_isdigit( const char *);
int krb5int_utf8_isxdigit( const char *);
int krb5int_utf8_isspace( const char *);

/* span characters not in set, return bytes spanned */
size_t krb5int_utf8_strcspn( const char* str, const char *set);
/* span characters in set, return bytes spanned */
size_t krb5int_utf8_strspn( const char* str, const char *set);
/* return first occurrence of character in string */
char *krb5int_utf8_strchr( const char* str, const char *chr);
/* return first character of set in string */
char *krb5int_utf8_strpbrk( const char* str, const char *set);
/* reentrant tokenizer */
char *krb5int_utf8_strtok( char* sp, const char* sep, char **last);

/* Optimizations */
extern const char krb5int_utf8_lentab[128];
extern const char krb5int_utf8_mintab[32];
Expand All @@ -157,38 +111,10 @@ extern const char krb5int_utf8_mintab[32];
(krb5int_utf8_mintab[KRB5_UTF8_BV(p) & 0x1f] & (p)[1])) ? \
l : 0)

#define KRB5_UTF8_OFFSET(p) (KRB5_UTF8_ISASCII(p) \
? 1 : krb5int_utf8_offset((p)) )

#define KRB5_UTF8_COPY(d,s) (KRB5_UTF8_ISASCII(s) \
? (*(d) = *(s), 1) : krb5int_utf8_copy((d),(s)))

#define KRB5_UTF8_NEXT(p) (KRB5_UTF8_ISASCII(p) \
? (char *)(p)+1 : krb5int_utf8_next((p)))

#define KRB5_UTF8_INCR(p) ((p) = KRB5_UTF8_NEXT(p))

/* For symmetry */
#define KRB5_UTF8_PREV(p) (krb5int_utf8_prev((p)))
#define KRB5_UTF8_DECR(p) ((p)=KRB5_UTF8_PREV((p)))

/*
* these macros assume 'x' is an ASCII x
* and assume the "C" locale
*/
#define KRB5_ASCII(c) (!((c) & 0x80))
#define KRB5_SPACE(c) ((c) == ' ' || (c) == '\t' || (c) == '\n')
#define KRB5_DIGIT(c) ((c) >= '0' && (c) <= '9')
#define KRB5_LOWER(c) ((c) >= 'a' && (c) <= 'z')
#define KRB5_UPPER(c) ((c) >= 'A' && (c) <= 'Z')
#define KRB5_ALPHA(c) (KRB5_LOWER(c) || KRB5_UPPER(c))
#define KRB5_ALNUM(c) (KRB5_ALPHA(c) || KRB5_DIGIT(c))

#define KRB5_LDH(c) (KRB5_ALNUM(c) || (c) == '-')

#define KRB5_HEXLOWER(c) ((c) >= 'a' && (c) <= 'f')
#define KRB5_HEXUPPER(c) ((c) >= 'A' && (c) <= 'F')
#define KRB5_HEX(c) (KRB5_DIGIT(c) || \
KRB5_HEXLOWER(c) || KRB5_HEXUPPER(c))

#endif /* K5_UTF8_H */
11 changes: 2 additions & 9 deletions src/lib/krb5/unicode/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,15 @@ BUILDTOP=$(REL)..$(S)..$(S)..
##DOS##OBJFILE=..\$(OUTPRE)$(PREFIXDIR).lst

XXDIR = $(srcdir)/ucdata/
XXHEADERS = ucdata.h ure.h uctable.h
XXSRCS = ucdata.c ucgendat.c ure.c urestubs.c
XXHEADERS = ucdata.h uctable.h
XXSRCS = ucdata.c ucgendat.c

STLIBOBJS= \
ucdata.o \
ure.o \
urestubs.o \
ucstr.o

OBJS= \
$(OUTPRE)ucdata.$(OBJEXT) \
$(OUTPRE)ure.$(OBJEXT) \
$(OUTPRE)urestubs.$(OBJEXT) \
$(OUTPRE)ucstr.$(OBJEXT)

SRCS= \
Expand Down Expand Up @@ -57,9 +53,6 @@ ucgendat: ucgendat.o
##DOS## $(CP) $(srcdir)\ucdata\ucdata.c ucdata.c
##DOS## $(CP) $(srcdir)\ucdata\ucgendat.c ucgendat.c
##DOS## $(CP) $(srcdir)\ucdata\uctable.h uctable.h
##DOS## $(CP) $(srcdir)\ure\ure.h ure.h
##DOS## $(CP) $(srcdir)\ure\ure.c ure.c
##DOS## $(CP) $(srcdir)\ure\urestubs.c urestubs.c
##DOS## $(CP) nul .links

$(XXSRCS) $(XXHEADERS) : .links
Expand Down
84 changes: 0 additions & 84 deletions src/lib/krb5/unicode/ucdata/bidiapi.txt

This file was deleted.

0 comments on commit 50b7ae4

Please sign in to comment.