summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Pipping <sebastian@pipping.org>2021-02-25 20:56:33 +0100
committerSebastian Pipping <sebastian@pipping.org>2021-02-26 22:26:51 +0100
commit5c2de5067a2f3ab5864e41de777e10de7efdd3cc (patch)
tree1023c9eb4330876afad8ca721c04314fefa29674
parentcaad64784704b22b3556d8b33feeaf635173b4fe (diff)
downloaduriparser-5c2de5067a2f3ab5864e41de777e10de7efdd3cc.tar.gz
UriCommon.c: Move code down into branches (for upcoming changes)
-rw-r--r--src/UriCommon.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/UriCommon.c b/src/UriCommon.c
index 1afa679..78c4554 100644
--- a/src/UriCommon.c
+++ b/src/UriCommon.c
@@ -314,16 +314,23 @@ UriBool URI_FUNC(RemoveDotSegmentsEx)(URI_TYPE(Uri) * uri,
}
} else {
URI_TYPE(PathSegment) * const anotherNextBackup = walker->next;
- /* First segment -> update head pointer
- * OLD: head -> walker -> (next|NULL)
- * NEW: head -----------> (next|NULL) */
- uri->pathHead = walker->next;
+ /* First segment */
if (walker->next != NULL) {
+ /* First segment of multiple -> update head
+ * OLD: head -> walker -> next
+ * NEW: head -----------> next */
+ uri->pathHead = walker->next;
+
/* Update parent link as well
* OLD: head <- walker <- next
* NEW: head <----------- next */
walker->next->reserved = NULL;
} else {
+ /* First and only segment -> update head
+ * OLD: head -> walker -> NULL
+ * NEW: head -----------> NULL */
+ uri->pathHead = NULL;
+
/* Last segment -> update tail
* OLD: tail -> walker
* NEW: tail -> NULL */