qh_sticky_error_last()

Updated: April 19, 2023

Store a new error code as a variable if the new error is not zero

Synopsis:

#include <qh/error.h>
int qh_sticky_error_last(int *sticky_error,
                         int new_error)

Arguments:

sticky_error
The location in which to store the last error code encountered in successive calls to the function.
new_error
The new error code to use, if not 0.

Library:

qh

Description:

This function allows a caller to make successive calls with a sticky_error variable and a new, potentially different error. After the caller makes successive calls to the this function, it can look at the value of sticky_error to determine what the last error was, if any.

Returns:

The value of new_error.