lv_check_arg.h

Defines

LV_LIKELY(x)
LV_UNLIKELY(x)
LV_CHECK_ARG_INTERNAL_(cond, cond_str, action_on_fail, ...)

Internal macro: checks a condition, logs a warning, and executes the specified action on failure. Do not use directly; use LV_CHECK_ARG instead.

LV_CHECK_ARG(cond, action_on_fail, ...)

Check that a condition is true. If the condition is false, log a warning and execute action_on_fail (e.g. return, return val, break). Additional printf-style arguments are appended to the log message.

Can be disabled entirely by setting LV_USE_CHECK_ARG to 0 in lv_conf.h. If LV_CHECK_ARG_ASSERT_ON_FAIL is 1, LV_ASSERT_HANDLER is also invoked before the action.

Example:

LV_CHECK_ARG(ptr != NULL, return, "pointer must not be NULL");
LV_CHECK_ARG(len > 0, return -1, "len=%d", (int)len);

Parameters:
  • cond – condition to check

  • action_on_fail – statement to execute on failure (e.g. return, return 0, break)

  • ... – optional printf-style format string and arguments appended to the log