Skip to content

Commit

Permalink
Only have isUTF8() for libidn2/libidn builds
Browse files Browse the repository at this point in the history
  • Loading branch information
rockdaboot committed Feb 10, 2024
1 parent 0fdbd1b commit 7f935c9
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/psl.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,14 +330,6 @@ static int suffix_init(psl_entry_t *suffix, const char *rule, size_t length)
return 0;
}

/* Avoid using strcasecmp() or _stricmp() */
static int isUTF8(const char *s) {
return (s[0] == 'u' || s[0] == 'U')
&& (s[1] == 't' || s[1] == 'T')
&& (s[2] == 'f' || s[2] == 'F')
&& s[3] == '-' && s[4] == 0;
}

#if !defined(WITH_LIBIDN) && !defined(WITH_LIBIDN2) && !defined(WITH_LIBICU)
/*
* When configured without runtime IDNA support (./configure --disable-runtime), we need a pure ASCII
Expand Down Expand Up @@ -1699,6 +1691,16 @@ void psl_free_string(char *str)
free(str);
}

#if defined(WITH_LIBIDN2) || defined(WITH_LIBIDN)
/* Avoid using strcasecmp() or _stricmp() */
static int isUTF8(const char *s) {
return (s[0] == 'u' || s[0] == 'U')
&& (s[1] == 't' || s[1] == 'T')
&& (s[2] == 'f' || s[2] == 'F')
&& s[3] == '-' && s[4] == 0;
}
#endif

/**
* psl_str_to_utf8lower:
* @str: string to convert
Expand Down

0 comments on commit 7f935c9

Please sign in to comment.