utils/macros.h: Add <ctype.h> and `foocmp' helper macros.
[mLib] / codec / url.c
index 0de87ae..eecfe82 100644 (file)
@@ -33,6 +33,7 @@
 #include <string.h>
 
 #include "dstr.h"
+#include "macros.h"
 #include "url.h"
 
 /*----- Main code ---------------------------------------------------------*/
@@ -66,8 +67,8 @@ static void encode(url_ectx *ctx, dstr *d, const char *p)
       case ' ': DPUTC(d, '+');
        break;
       default:
-       if (isspace((unsigned char)*p)) goto unsafe;
-       else if (isalnum((unsigned char)*p)) goto safe;
+       if (ISSPACE(*p)) goto unsafe;
+       else if (ISALNUM(*p)) goto safe;
        else if (ctx->f&URLF_LAX) goto safe;
        else goto unsafe;
       case '/': case '~':