diff options
author | Richard Levitte <levitte@openssl.org> | 2019-11-09 00:18:05 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2019-11-29 20:42:12 +0100 |
commit | 3d83c7353630450a4ce4fffc9c75693565e094c2 (patch) | |
tree | d41f784818c5f092e91abf46a01f76ebd6c7894e /doc | |
parent | cc38e643cbfb6da84fb2bb6a188698d0bc082a20 (diff) |
CORE: ossl_namemap_add_names(): new function to add multiple names
This was originally the private add_names_to_namemap() in
crypto/evp/evp_fetch.c, but made more generally useful.
To make for more consistent function naming, ossl_namemap_add() and
ossl_namemap_add_n() are renamed to ossl_namemap_add_name() and
ossl_namemap_add_name_n().
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10394)
Diffstat (limited to 'doc')
-rw-r--r-- | doc/internal/man3/ossl_namemap_new.pod | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/doc/internal/man3/ossl_namemap_new.pod b/doc/internal/man3/ossl_namemap_new.pod index b66fd91957..e041510c4a 100644 --- a/doc/internal/man3/ossl_namemap_new.pod +++ b/doc/internal/man3/ossl_namemap_new.pod @@ -3,7 +3,7 @@ =head1 NAME ossl_namemap_new, ossl_namemap_free, ossl_namemap_stored, ossl_namemap_empty, -ossl_namemap_add, ossl_namemap_add_n, +ossl_namemap_add_name, ossl_namemap_add_name_n, ossl_namemap_add_names, ossl_namemap_name2num, ossl_namemap_name2num_n, ossl_namemap_doall_names - internal number E<lt>-E<gt> name map @@ -18,9 +18,9 @@ ossl_namemap_doall_names void ossl_namemap_free(OSSL_NAMEMAP *namemap); int ossl_namemap_empty(OSSL_NAMEMAP *namemap); - int ossl_namemap_add(OSSL_NAMEMAP *namemap, int number, const char *name); - int ossl_namemap_add_n(OSSL_NAMEMAP *namemap, int number, - const char *name, size_t name_len); + int ossl_namemap_add_name(OSSL_NAMEMAP *namemap, int number, const char *name); + int ossl_namemap_add_name_n(OSSL_NAMEMAP *namemap, int number, + const char *name, size_t name_len); int ossl_namemap_name2num(const OSSL_NAMEMAP *namemap, const char *name); int ossl_namemap_name2num_n(const OSSL_NAMEMAP *namemap, @@ -29,6 +29,9 @@ ossl_namemap_doall_names void (*fn)(const char *name, void *data), void *data); + int ossl_namemap_add_names(OSSL_NAMEMAP *namemap, int number, + const char *names, const char separator); + =head1 DESCRIPTION A B<OSSL_NAMEMAP> is a one-to-many number E<lt>-E<gt> names map, which @@ -49,7 +52,7 @@ given library context. The returned B<OSSL_NAMEMAP> can't be destructed using ossl_namemap_free(). -ossl_namemap_add() adds a new name to the namemap if it's not already +ossl_namemap_add_name() adds a new name to the namemap if it's not already present. If the given I<number> is zero, a new number will be allocated to identify this I<name>. @@ -59,18 +62,23 @@ names already associated with that number. ossl_namemap_name2num() finds the number corresponding to the given I<name>. -ossl_namemap_add_n() and ossl_namemap_name2num_n() do the same thing -as ossl_namemap_add() and ossl_namemap_name2num(), but take a string +ossl_namemap_add_name_n() and ossl_namemap_name2num_n() do the same thing +as ossl_namemap_add_name() and ossl_namemap_name2num(), but take a string length I<name_len> as well, allowing the caller to use a fragment of a string as a name. - ossl_namemap_doall_names() walks through all names associated with I<number> in the given I<namemap> and calls the function I<fn> for each of them. I<fn> is also passed the I<data> argument, which allows any caller to pass extra data for that function to use. +ossl_namemap_add_names() divides up a set of names given in I<names>, +separated by I<separator>, and adds each to the I<namemap>, all with +the same number. If some of them already exist in the I<namemap>, +they must all have the same associated number, which will be adopted +for any name that doesn't exist yet. + =head1 RETURN VALUES ossl_namemap_new() and ossl_namemap_stored() return the pointer to a @@ -79,8 +87,8 @@ B<OSSL_NAMEMAP>, or NULL on error. ossl_namemap_empty() returns 1 if the B<OSSL_NAMEMAP> is NULL or empty, or 0 if it's not empty. -ossl_namemap_add() and ossl_namemap_add_n() return the number associated -with the added string, or zero on error. +ossl_namemap_add_name() and ossl_namemap_add_name_n() return the number +associated with the added string, or zero on error. ossl_namemap_num2names() returns a pointer to a NULL-terminated list of pointers to the names corresponding to the given number, or NULL if @@ -90,6 +98,9 @@ ossl_namemap_name2num() and ossl_namemap_name2num_n() return the number corresponding to the given name, or 0 if it's undefined in the given B<OSSL_NAMEMAP>. +ossl_namemap_add_names() returns the number associated with the added +names, or zero on error. + =head1 NOTES The result from ossl_namemap_num2names() isn't thread safe, other threads |