Commit 0f9b5786 authored by Jakob Bornecrantz's avatar Jakob Bornecrantz
Browse files

st/oxr: Remove unnecessary NULL check

parent a8ae7c43
Pipeline #58102 passed with stages
in 46 seconds
......@@ -81,9 +81,6 @@ push(struct oxr_instance *inst, struct oxr_event *event)
if (ret != XR_SUCCESS) { \
return ret; \
} \
if (event == NULL) { \
return XR_ERROR_RUNTIME_FAILURE; \
} \
*extra = (typeof(*extra))(*event)->ptr(); \
} while (false)
......
  • so clang-tidy somehow had trouble understanding that we wouldn't get here with a null pointer, which is why this got added. Wonder if there's an issue further up.

  • image

  • When I compile with optimizations I get warnings about that if statement never being true.

  • Maybe if we turned oxr_error into a static inline function?

  • Or a horrible define using comma expressions.

    #define oxr_error(log, ret, ...) \
      (oxr_real_error(log, ret, VARG_ARGS), ret)
  • well, we could conceal the oxr_real_error impl, and just expose approximately

    static inline XrResult oxr_error(log, ret, ...) {
        va_list varying_list;
        va_start(varying_list, ret);
        oxr_real_error(log, ret, varying_list);
        va_end(varying_list);
        return ret;
    }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment