CVSROOT:        /cvs
Module name:    src
Changes by:     t...@cvs.openbsd.org    2023/12/13 16:28:48

Modified files:
        lib/libcrypto/objects: obj_dat.c 

Log message:
Simplify OBJ_obj2nid()

Continue with OBJ_bsearch_() elimination.

OBJ_obj2nid() first checks if the object identifier passed in has a nid
and if so, it returns that. Otherwise, it looks into the global hash of
added objects (of course without locking) for a match and then returns
the nid thereof. As a last attempt, it searches the table of built-in
object identifiers.

The last two steps can be cleaned up and simplified quite a bit by using
C99 initializers, bsearch() and an appropriate comparison function. Then
it becomes obvious that bsearch() already returns a pointer to the nid
we're looking for, so there is no point in converting that into its
corresponding obj and returning the nid thereof.

ok jsing

Reply via email to