Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sergi
Tor
Commits
542b4701
Commit
542b4701
authored
10 years ago
by
Nick Mathewson
Browse files
Options
Downloads
Patches
Plain Diff
Refactor {str,digest}map into a common implementation; add digest256map
Needed for #13399.
parent
5ad87218
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
changes/bug13399_part1
+3
-0
3 additions, 0 deletions
changes/bug13399_part1
src/common/container.c
+274
-399
274 additions, 399 deletions
src/common/container.c
src/common/container.h
+10
-0
10 additions, 0 deletions
src/common/container.h
with
287 additions
and
399 deletions
changes/bug13399_part1
0 → 100644
+
3
−
0
View file @
542b4701
o Code simplifications and refactoring:
- Refactor our generic strmap and digestmap types into a single
implementation, so that we can add a new digest256map type trivially.
This diff is collapsed.
Click to expand it.
src/common/container.c
+
274
−
399
View file @
542b4701
This diff is collapsed.
Click to expand it.
src/common/container.h
+
10
−
0
View file @
542b4701
...
...
@@ -346,6 +346,9 @@ char *smartlist_join_strings2(smartlist_t *sl, const char *join,
DECLARE_MAP_FNS
(
strmap_t
,
const
char
*
,
strmap_
);
/* Map from const char[DIGEST_LEN] to void *. Implemented with a hash table. */
DECLARE_MAP_FNS
(
digestmap_t
,
const
char
*
,
digestmap_
);
/* Map from const uint8_t[DIGEST_LEN] to void *. Implemented with a hash
* table. */
DECLARE_MAP_FNS
(
digest256map_t
,
const
uint8_t
*
,
digest256map_
);
#undef DECLARE_MAP_FNS
...
...
@@ -461,6 +464,13 @@ DECLARE_MAP_FNS(digestmap_t, const char *, digestmap_);
/** Used to end a DIGESTMAP_FOREACH() block. */
#define DIGESTMAP_FOREACH_END MAP_FOREACH_END
#define DIGEST256MAP_FOREACH(map, keyvar, valtype, valvar) \
MAP_FOREACH(digest256map_, map, const uint8_t *, keyvar, valtype, valvar)
#define DIGEST256MAP_FOREACH_MODIFY(map, keyvar, valtype, valvar) \
MAP_FOREACH_MODIFY(digest256map_, map, const uint8_t *, \
keyvar, valtype, valvar)
#define DIGEST256MAP_FOREACH_END MAP_FOREACH_END
#define STRMAP_FOREACH(map, keyvar, valtype, valvar) \
MAP_FOREACH(strmap_, map, const char *, keyvar, valtype, valvar)
#define STRMAP_FOREACH_MODIFY(map, keyvar, valtype, valvar) \
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment