Skip to content

Commit

Permalink
feat(error-utils): add functions for utility
Browse files Browse the repository at this point in the history
  • Loading branch information
Tonidotpy committed Oct 1, 2023
1 parent 51eecb4 commit e5fea48
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
12 changes: 11 additions & 1 deletion error-utils/error_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,4 +459,14 @@ void error_utils_expire_errors(ErrorUtilsHandler * handler) {
// Update handler info
++(handler->expired);
--(handler->running);
}
}
size_t error_utils_running_count(ErrorUtilsHandler * handler) {
if (handler == NULL)
return 0;
return handler->running;
}
size_t error_utils_expired_count(ErrorUtilsHandler * handler) {
if (handler == NULL)
return 0;
return handler->expired;
}
17 changes: 15 additions & 2 deletions error-utils/error_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,19 @@ bool error_utils_reset(
* @param handler The error handler structure
*/
void error_utils_expire_errors(ErrorUtilsHandler * handler);
/**
* @brief Get the number of currently running errors
*
* @param handler The error handler structure
* @return size_t The number of running errors
*/
size_t error_utils_running_count(ErrorUtilsHandler * handler);
/**
* @brief Get the numer of expired errors
*
* @param handler The error handler structure
* @return size_t The number of expired errors
*/
size_t error_utils_expired_count(ErrorUtilsHandler * handler);


#endif // ERROR_UTILS_H
#endif // ERROR_UTILS_H

0 comments on commit e5fea48

Please sign in to comment.