Skip to content

Commit d279379

Browse files
doc: Improve API docs of _context_set_illegal_callback
1 parent 6b64774 commit d279379

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

include/secp256k1.h

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ SECP256K1_DEPRECATED("Use secp256k1_context_static instead");
261261
* secp256k1_context_create (or secp256k1_context_preallocated_create), which will
262262
* take care of performing the self tests.
263263
*
264-
* If the tests fail, this function will call the default error handler to abort the
264+
* If the tests fail, this function will call the default error callback to abort the
265265
* program (see secp256k1_context_set_error_callback).
266266
*/
267267
SECP256K1_API void secp256k1_selftest(void);
@@ -336,34 +336,35 @@ SECP256K1_API void secp256k1_context_destroy(
336336
*
337337
* The philosophy is that these shouldn't be dealt with through a
338338
* specific return value, as calling code should not have branches to deal with
339-
* the case that this code itself is broken.
339+
* the case that this code itself is broken. On the other hand, during debug
340+
* stage, one would want to be informed about such mistakes, and the default
341+
* (crashing) may be inadvisable.
340342
*
341-
* On the other hand, during debug stage, one would want to be informed about
342-
* such mistakes, and the default (crashing) may be inadvisable.
343343
* When this callback is triggered, the API function called is guaranteed not
344344
* to cause a crash, though its return value and output arguments are
345345
* undefined. A single API call may trigger the callback more than once.
346346
*
347-
* When this function has not been called (or called with fn==NULL), then the
348-
* default handler will be used. The library provides a default handler which
349-
* writes the message to stderr and calls abort. This default handler can be
347+
* When this function has not been called (or called with fun==NULL), then the
348+
* default callback will be used. The library provides a default callback which
349+
* writes the message to stderr and calls abort. This default callback can be
350350
* replaced at link time if the preprocessor macro
351351
* USE_EXTERNAL_DEFAULT_CALLBACKS is defined, which is the case if the build
352352
* has been configured with --enable-external-default-callbacks. Then the
353353
* following two symbols must be provided to link against:
354354
* - void secp256k1_default_illegal_callback_fn(const char *message, void *data);
355355
* - void secp256k1_default_error_callback_fn(const char *message, void *data);
356-
* The library can call these default handlers even before a proper callback data
356+
* The library may call a default callback even before a proper callback data
357357
* pointer could have been set using secp256k1_context_set_illegal_callback or
358358
* secp256k1_context_set_error_callback, e.g., when the creation of a context
359-
* fails. In this case, the corresponding default handler will be called with
359+
* fails. In this case, the corresponding default callback will be called with
360360
* the data pointer argument set to NULL.
361361
*
362362
* Args: ctx: pointer to a context object.
363363
* In: fun: pointer to a function to call when an illegal argument is
364364
* passed to the API, taking a message and an opaque pointer.
365-
* (NULL restores the default handler.)
366-
* data: the opaque pointer to pass to fun above, must be NULL for the default handler.
365+
* (NULL restores the default callback.)
366+
* data: the opaque pointer to pass to fun above, must be NULL for the
367+
* default callback.
367368
*
368369
* See also secp256k1_context_set_error_callback.
369370
*/
@@ -380,18 +381,19 @@ SECP256K1_API void secp256k1_context_set_illegal_callback(
380381
* to abort the program.
381382
*
382383
* This can only trigger in case of a hardware failure, miscompilation,
383-
* memory corruption, serious bug in the library, or other error would can
384-
* otherwise result in undefined behaviour. It will not trigger due to mere
384+
* memory corruption, serious bug in the library, or other error that would
385+
* result in undefined behaviour. It will not trigger due to mere
385386
* incorrect usage of the API (see secp256k1_context_set_illegal_callback
386387
* for that). After this callback returns, anything may happen, including
387388
* crashing.
388389
*
389390
* Args: ctx: pointer to a context object.
390391
* In: fun: pointer to a function to call when an internal error occurs,
391392
* taking a message and an opaque pointer (NULL restores the
392-
* default handler, see secp256k1_context_set_illegal_callback
393+
* default callback, see secp256k1_context_set_illegal_callback
393394
* for details).
394-
* data: the opaque pointer to pass to fun above, must be NULL for the default handler.
395+
* data: the opaque pointer to pass to fun above, must be NULL for the
396+
* default callback.
395397
*
396398
* See also secp256k1_context_set_illegal_callback.
397399
*/

0 commit comments

Comments
 (0)