summaryrefslogtreecommitdiff
path: root/pjlib/include
diff options
context:
space:
mode:
Diffstat (limited to 'pjlib/include')
-rw-r--r--pjlib/include/pj/config.h13
-rw-r--r--pjlib/include/pj/string.h8
-rw-r--r--pjlib/include/pj/string_i.h2
3 files changed, 23 insertions, 0 deletions
diff --git a/pjlib/include/pj/config.h b/pjlib/include/pj/config.h
index 2e6995da..896cfd5b 100644
--- a/pjlib/include/pj/config.h
+++ b/pjlib/include/pj/config.h
@@ -365,6 +365,19 @@
#endif
+/**
+ * Include pj_stricmp_alnum() and pj_strnicmp_alnum(), i.e. custom
+ * functions to compare alnum strings. On some systems, they're faster
+ * then stricmp/strcasecmp, but they can be slower on other systems.
+ * When disabled, pjlib will fallback to stricmp/strnicmp.
+ *
+ * Default: 0
+ */
+#ifndef PJ_HAS_STRICMP_ALNUM
+# define PJ_HAS_STRICMP_ALNUM 0
+#endif
+
+
/** @} */
/********************************************************************
diff --git a/pjlib/include/pj/string.h b/pjlib/include/pj/string.h
index 90ab29e8..6831e04b 100644
--- a/pjlib/include/pj/string.h
+++ b/pjlib/include/pj/string.h
@@ -369,8 +369,12 @@ PJ_IDECL(int) pj_stricmp(const pj_str_t *str1, const pj_str_t *str2);
* - 0 if str1 is equal to str2
* - (-1) if not equal.
*/
+#if defined(PJ_HAS_STRICMP_ALNUM) && PJ_HAS_STRICMP_ALNUM!=0
PJ_IDECL(int) strnicmp_alnum(const char *str1, const char *str2,
int len);
+#else
+#define strnicmp_alnum strnicmp
+#endif
/**
* Perform lowercase comparison to the strings which consists of only
@@ -387,7 +391,11 @@ PJ_IDECL(int) strnicmp_alnum(const char *str1, const char *str2,
* - 0 if str1 is equal to str2
* - (-1) if not equal.
*/
+#if defined(PJ_HAS_STRICMP_ALNUM) && PJ_HAS_STRICMP_ALNUM!=0
PJ_IDECL(int) pj_stricmp_alnum(const pj_str_t *str1, const pj_str_t *str2);
+#else
+#define pj_stricmp_alnum pj_stricmp
+#endif
/**
* Perform lowercase comparison to the strings.
diff --git a/pjlib/include/pj/string_i.h b/pjlib/include/pj/string_i.h
index 25fc0368..57cae7ba 100644
--- a/pjlib/include/pj/string_i.h
+++ b/pjlib/include/pj/string_i.h
@@ -195,6 +195,7 @@ PJ_IDEF(int) pj_stricmp( const pj_str_t *str1, const pj_str_t *str2)
}
}
+#if defined(PJ_HAS_STRICMP_ALNUM) && PJ_HAS_STRICMP_ALNUM!=0
PJ_IDEF(int) strnicmp_alnum( const char *str1, const char *str2,
int len)
{
@@ -263,6 +264,7 @@ PJ_IDEF(int) pj_stricmp_alnum(const pj_str_t *str1, const pj_str_t *str2)
return 0;
}
}
+#endif /* PJ_HAS_STRICMP_ALNUM */
PJ_IDEF(int) pj_stricmp2( const pj_str_t *str1, const char *str2)
{