... and make Curl_isunreserved() use that macro instead of providing a
separate funtion for the purpose.

Closes #11840
This commit is contained in:
Daniel Stenberg 2023-09-12 15:38:02 +02:00
Родитель 6fa1d817e5
Коммит 291d225a50
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 5CC908FDB71E12C2
3 изменённых файлов: 7 добавлений и 28 удалений

Просмотреть файл

@ -43,5 +43,9 @@
#define ISDIGIT(x) (((x) >= '0') && ((x) <= '9')) #define ISDIGIT(x) (((x) >= '0') && ((x) <= '9'))
#define ISBLANK(x) (((x) == ' ') || ((x) == '\t')) #define ISBLANK(x) (((x) == ' ') || ((x) == '\t'))
#define ISSPACE(x) (ISBLANK(x) || (((x) >= 0xa) && ((x) <= 0x0d))) #define ISSPACE(x) (ISBLANK(x) || (((x) >= 0xa) && ((x) <= 0x0d)))
#define isurlpuntcs(x) (((x) == '-') || ((x) == '.') || ((x) == '_') || \
((x) == '~'))
#define ISUNRESERVED(x) (ISALNUM(x) || isurlpuntcs(x))
#endif /* HEADER_CURL_CTYPE_H */ #endif /* HEADER_CURL_CTYPE_H */

Просмотреть файл

@ -38,33 +38,6 @@
#include "curl_memory.h" #include "curl_memory.h"
#include "memdebug.h" #include "memdebug.h"
/* Portable character check (remember EBCDIC). Do not use isalnum() because
its behavior is altered by the current locale.
See https://datatracker.ietf.org/doc/html/rfc3986#section-2.3
*/
bool Curl_isunreserved(unsigned char in)
{
switch(in) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
case 'a': case 'b': case 'c': case 'd': case 'e':
case 'f': case 'g': case 'h': case 'i': case 'j':
case 'k': case 'l': case 'm': case 'n': case 'o':
case 'p': case 'q': case 'r': case 's': case 't':
case 'u': case 'v': case 'w': case 'x': case 'y': case 'z':
case 'A': case 'B': case 'C': case 'D': case 'E':
case 'F': case 'G': case 'H': case 'I': case 'J':
case 'K': case 'L': case 'M': case 'N': case 'O':
case 'P': case 'Q': case 'R': case 'S': case 'T':
case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z':
case '-': case '.': case '_': case '~':
return TRUE;
default:
break;
}
return FALSE;
}
/* for ABI-compatibility with previous versions */ /* for ABI-compatibility with previous versions */
char *curl_escape(const char *string, int inlength) char *curl_escape(const char *string, int inlength)
{ {

Просмотреть файл

@ -26,7 +26,9 @@
/* Escape and unescape URL encoding in strings. The functions return a new /* Escape and unescape URL encoding in strings. The functions return a new
* allocated string or NULL if an error occurred. */ * allocated string or NULL if an error occurred. */
bool Curl_isunreserved(unsigned char in); #include "curl_ctype.h"
#define Curl_isunreserved(x) ISUNRESERVED(x)
enum urlreject { enum urlreject {
REJECT_NADA = 2, REJECT_NADA = 2,