1
0
mirror of https://gitlab.xiph.org/xiph/icecast-common.git synced 2024-12-04 14:46:31 -05:00

Feature: Added igloo_instance_validate()

This commit is contained in:
Philipp Schafft 2019-09-15 15:32:39 +00:00
parent 3b68465b67
commit aad572fe38
2 changed files with 22 additions and 0 deletions

View File

@ -113,6 +113,19 @@ igloo_objecthandler_t * igloo_instance_get_logger(igloo_ro_t self);
*/ */
igloo_error_t igloo_instance_log(igloo_ro_t self, igloo_ro_t msg); igloo_error_t igloo_instance_log(igloo_ro_t self, igloo_ro_t msg);
/* Validate an instance.
*
* Note: This is very useful when a instance is passed from a user to a library.
*
* Parameters:
* self
* An instance to validate.
* Returns:
* igloo_ERROR_NONE if self is a valid instance, or error code otherwise.
*/
igloo_error_t igloo_instance_validate_raw(igloo_ro_t self);
#define igloo_instance_validate(x) igloo_instance_validate_raw((x))
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -241,3 +241,12 @@ igloo_error_t igloo_instance_log(igloo_ro_t self, igloo_ro_t msg)
return ret; return ret;
} }
igloo_error_t igloo_instance_validate_raw(igloo_ro_t self)
{
if (igloo_RO_IS_VALID(self, igloo_instance_t)) {
return igloo_ERROR_NONE;
} else {
return igloo_ERROR_GENERIC;
}
}