Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ccan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mirror
ccan
Commits
532980db
Commit
532980db
authored
Oct 07, 2010
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hash: fix examples so they compile.
parent
3adbb41d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
ccan/hash/hash.h
ccan/hash/hash.h
+10
-6
No files found.
ccan/hash/hash.h
View file @
532980db
...
...
@@ -29,9 +29,10 @@
* See also: hash64, hash_stable.
*
* Example:
* #include
"hash/hash.h"
* #include
<ccan/hash/hash.h>
* #include <err.h>
* #include <stdio.h>
* #include <string.h>
*
* // Simple demonstration: idential strings will have the same hash, but
* // two different strings will probably not.
...
...
@@ -74,9 +75,10 @@
* hash64_stable
*
* Example:
* #include
"hash/hash.h"
* #include
<ccan/hash/hash.h>
* #include <err.h>
* #include <stdio.h>
* #include <string.h>
*
* int main(int argc, char *argv[])
* {
...
...
@@ -159,6 +161,7 @@ static inline uint32_t hash_string(const char *string)
* #include <ccan/hash/hash.h>
* #include <err.h>
* #include <stdio.h>
* #include <string.h>
*
* // Simple demonstration: idential strings will have the same hash, but
* // two different strings will probably not.
...
...
@@ -204,6 +207,7 @@ static inline uint32_t hash_string(const char *string)
* #include <ccan/hash/hash.h>
* #include <err.h>
* #include <stdio.h>
* #include <string.h>
*
* int main(int argc, char *argv[])
* {
...
...
@@ -263,7 +267,7 @@ uint64_t hash64_stable_8(const void *key, size_t n, uint64_t base);
* network or saved to disk).
*
* Example:
* #include
"hash/hash.h"
* #include
<ccan/hash/hash.h>
*
* // Code to keep track of memory regions.
* struct region {
...
...
@@ -276,17 +280,17 @@ uint64_t hash64_stable_8(const void *key, size_t n, uint64_t base);
*
* static void add_region(struct region *r)
* {
* unsigned int h = hash_pointer(r->start);
* unsigned int h = hash_pointer(r->start
, 0
);
*
* r->chain = region_hash[h];
* region_hash[h] = r->chain;
* }
*
* static
void
find_region(const void *start)
* static
struct region *
find_region(const void *start)
* {
* struct region *r;
*
* for (r = region_hash[hash_pointer(start)]; r; r = r->chain)
* for (r = region_hash[hash_pointer(start
, 0
)]; r; r = r->chain)
* if (r->start == start)
* return r;
* return NULL;
...
...
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