summaryrefslogtreecommitdiff
path: root/src/UriCommon.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhsoting.net>2014-10-20 18:43:39 +0200
committerJörg Frings-Fürst <debian@jff-webhsoting.net>2014-10-20 18:43:39 +0200
commit7cf57ee38648ce5729b97209e4bf87ae92c726b6 (patch)
tree7a1e89b9c5e85db7ecd736cb0fa375277de8def1 /src/UriCommon.c
parent58048f62e9ce8d1754192edd702f7f3bbcea24c6 (diff)
parentc3ccf5e3e6737f81863b085289fd830e732b41f9 (diff)
Merge tag 'upstream/0.8.1'
Upstream version 0.8.1
Diffstat (limited to 'src/UriCommon.c')
-rw-r--r--src/UriCommon.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/UriCommon.c b/src/UriCommon.c
index c33a4ca..c50d89b 100644
--- a/src/UriCommon.c
+++ b/src/UriCommon.c
@@ -80,6 +80,29 @@ void URI_FUNC(ResetUri)(URI_TYPE(Uri) * uri) {
+/* Compares two text ranges for equal text content */
+int URI_FUNC(CompareRange)(
+ const URI_TYPE(TextRange) * a,
+ const URI_TYPE(TextRange) * b) {
+ int diff;
+
+ /* NOTE: Both NULL means equal! */
+ if ((a == NULL) || (b == NULL)) {
+ return ((a == NULL) ? 0 : 1) - ((b == NULL) ? 0 : 1);
+ }
+
+ diff = ((int)(a->afterLast - a->first) - (int)(b->afterLast - b->first));
+ if (diff > 0) {
+ return 1;
+ } else if (diff < 0) {
+ return -1;
+ }
+
+ return URI_STRNCMP(a->first, b->first, (a->afterLast - a->first));
+}
+
+
+
/* Properly removes "." and ".." path segments */
UriBool URI_FUNC(RemoveDotSegments)(URI_TYPE(Uri) * uri,
UriBool relative) {