Skip to content

Commit

Permalink
Unicode: fix incomplete conditional use of options
Browse files Browse the repository at this point in the history
  • Loading branch information
AlekseyCherepanov committed Sep 15, 2024
1 parent f5d53d1 commit d575941
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/unicode.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@
#include <stdint.h>
#include <stdlib.h>

#ifndef UNICODE_NO_OPTIONS
#include "options.h"
#endif

#include "common.h"
#include "jumbo.h"

Expand Down Expand Up @@ -318,10 +321,16 @@ extern UTF8 CP_isUpper[0x100];
extern UTF8 CP_isSeparator[0x100];
extern UTF8 CP_isDigit[0x100];

#ifndef UNICODE_NO_OPTIONS
/* These are encoding-aware but not LC_CTYPE */
#define enc_islower(c) (options.internal_cp == ENC_RAW ? (c >= 'a' && c <= 'z') : CP_isLower[ARCH_INDEX(c)])
#define enc_isupper(c) (options.internal_cp == ENC_RAW ? (c >= 'A' && c <= 'Z') : CP_isUpper[ARCH_INDEX(c)])
#define enc_isdigit(c) (options.internal_cp == ENC_RAW ? (c >= '0' && c <= '9') : CP_isDigit[ARCH_INDEX(c)])
#else
#define enc_islower(c) (c >= 'a' && c <= 'z')
#define enc_isupper(c) (c >= 'A' && c <= 'Z')
#define enc_isdigit(c) (c >= '0' && c <= '9')
#endif
#define enc_tolower(c) (char)CP_down[ARCH_INDEX(c)]
#define enc_toupper(c) (char)CP_up[ARCH_INDEX(c)]

Expand Down

0 comments on commit d575941

Please sign in to comment.