Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-selector
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
libvmod-selector
Commits
43064f52
Commit
43064f52
authored
Jul 08, 2018
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some source code comments.
parent
971b9ed1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletion
+18
-1
patricia.c
src/patricia.c
+18
-1
No files found.
src/patricia.c
View file @
43064f52
...
...
@@ -41,6 +41,23 @@
#include "patricia.h"
/*
* A trie is comprised by a tree of pt_y nodes and an array of strings,
* both of which are owned by a VMOD object. Both are passed in to the
* PT_* functions.
*
* idx is an index to the strings array, and the region of the string
* represented at a node is strings[idx][off] to strings[idx][len],
* inclusive.
*
* Terminating nulls form a part of the target string. So "foo\0" and
* "foobar\0" differ at the fourth byte, and the critical bit at that byte
* is the most significant 1-bit in 'b'.
*
* bitmask is set at the critical bit in the differing byte, and
* determines whether searches continue into leaf[0] or leaf[1].
*/
struct
pt_y
{
unsigned
magic
;
#define PT_Y_MAGIC 0xfa564d14
...
...
@@ -176,7 +193,7 @@ PT_Insert(struct pt_y * * restrict root, unsigned idx,
if
(
i
==
y
->
len
)
{
/*
* The string to be inserted has a prefix that is
* already in the tr
e
e.
* already in the tr
i
e.
*/
bit
=
(
y
->
bitmask
&
*
c
)
!=
0
;
assert
(
bit
<
2
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment