Return the executor as return value and not via a parameter.
/**
* Determines the executor we are currently in.
*
- * @param executor Current executor pointer.
- *
- * @return Zero in case of success.
+ * @return Pointer to the current executor or NULL if not called
+ * within executor.
*/
-int forb_get_current_executor(forb_executor_t **executor)
+forb_executor_t *forb_get_current_executor(void)
{
- int ret = 0;
- *executor = (void *) pthread_getspecific(forb_executor_key);
-
- if (!(*executor))
- ret = 1;
- return ret;
+ return pthread_getspecific(forb_executor_key);
}
int forb_executor_run(forb_executor_t *executor);
int forb_execute_object(forb_object obj);
-int forb_get_current_executor(forb_executor_t **executor);
+forb_executor_t *forb_get_current_executor(void);
#endif
}
// ------------------------------------------------------
- if (forb_get_current_executor(&executor)) {
+ if ((executor = forb_get_current_executor())) {
printf("Test: Error while getting current executor\n");
if (executor == NULL)
printf("Test: Executor: NULL\n");