Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
Benjamin J. Thompson
Tor
Commits
e42a74e5
Commit
e42a74e5
authored
13 years ago
by
Robert Ransom
Committed by
Nick Mathewson
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add smartlist_[v]asprintf_add
I should have added this before implementing #2411.
parent
5f624805
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/common/util.c
+24
-0
24 additions, 0 deletions
src/common/util.c
src/common/util.h
+5
-0
5 additions, 0 deletions
src/common/util.h
with
29 additions
and
0 deletions
src/common/util.c
+
24
−
0
View file @
e42a74e5
...
...
@@ -2679,6 +2679,30 @@ tor_sscanf(const char *buf, const char *pattern, ...)
return
r
;
}
/** Append the string produced by tor_asprintf(<b>pattern</b>, <b>...</b>)
* to <b>sl</b>. */
void
smartlist_asprintf_add
(
struct
smartlist_t
*
sl
,
const
char
*
pattern
,
...)
{
va_list
ap
;
va_start
(
ap
,
pattern
);
smartlist_vasprintf_add
(
sl
,
pattern
,
ap
);
va_end
(
ap
);
}
/** va_list-based backend of smartlist_asprintf_add. */
void
smartlist_vasprintf_add
(
struct
smartlist_t
*
sl
,
const
char
*
pattern
,
va_list
args
)
{
char
*
str
=
NULL
;
tor_vasprintf
(
&
str
,
pattern
,
args
);
tor_assert
(
str
!=
NULL
);
smartlist_add
(
sl
,
str
);
}
/** Return a new list containing the filenames in the directory <b>dirname</b>.
* Return NULL on error or if <b>dirname</b> is not a directory.
*/
...
...
This diff is collapsed.
Click to expand it.
src/common/util.h
+
5
−
0
View file @
e42a74e5
...
...
@@ -220,6 +220,11 @@ int tor_sscanf(const char *buf, const char *pattern, ...)
#endif
;
void
smartlist_asprintf_add
(
struct
smartlist_t
*
sl
,
const
char
*
pattern
,
...)
CHECK_PRINTF
(
2
,
3
);
void
smartlist_vasprintf_add
(
struct
smartlist_t
*
sl
,
const
char
*
pattern
,
va_list
args
);
int
hex_decode_digit
(
char
c
);
void
base16_encode
(
char
*
dest
,
size_t
destlen
,
const
char
*
src
,
size_t
srclen
);
int
base16_decode
(
char
*
dest
,
size_t
destlen
,
const
char
*
src
,
size_t
srclen
);
...
...
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