aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/core/include/template.h7
-rw-r--r--src/lib/core/include/template_func_proto.h10
-rw-r--r--src/lib/core/template.c2
-rw-r--r--src/lib/core/template_func_proto.c10
-rw-r--r--tests/test_template.c2
5 files changed, 17 insertions, 14 deletions
diff --git a/src/lib/core/include/template.h b/src/lib/core/include/template.h
index e3d83fb..436fcc6 100644
--- a/src/lib/core/include/template.h
+++ b/src/lib/core/include/template.h
@@ -40,7 +40,9 @@ char *tpl_render(char *str);
*/
int tpl_render_to_file(char *str, const char *filename);
-typedef int tplfunc(void *frame, void *data_out);
+struct tplfunc_frame;
+
+typedef int tplfunc(struct tplfunc_frame *frame, void *data_out);
struct tplfunc_frame {
char *key; ///< Name of the function
@@ -68,8 +70,9 @@ struct tplfunc_frame {
* @param key function name to expose to "func:" interface
* @param tplfunc_ptr pointer to function of type tplfunc
* @param argc number of function arguments to accept
+ * @param data_in pointer to function input data
*/
-void tpl_register_func(char *key, void *tplfunc_ptr, int argc, void *data_in);
+void tpl_register_func(char *key, tplfunc *tplfunc_ptr, int argc, void *data_in);
/**
* Get the function frame associated with a template function
diff --git a/src/lib/core/include/template_func_proto.h b/src/lib/core/include/template_func_proto.h
index 286ccfb..0f2ad80 100644
--- a/src/lib/core/include/template_func_proto.h
+++ b/src/lib/core/include/template_func_proto.h
@@ -4,10 +4,10 @@
#include "template.h"
-int get_github_release_notes_tplfunc_entrypoint(void *frame, void *data_out);
-int get_github_release_notes_auto_tplfunc_entrypoint(void *frame, void *data_out);
-int get_junitxml_file_entrypoint(void *frame, void *data_out);
-int get_basetemp_dir_entrypoint(void *frame, void *data_out);
-int tox_run_entrypoint(void *frame, void *data_out);
+int get_github_release_notes_tplfunc_entrypoint(struct tplfunc_frame *frame, void *data_out);
+int get_github_release_notes_auto_tplfunc_entrypoint(struct tplfunc_frame *frame, void *data_out);
+int get_junitxml_file_entrypoint(struct tplfunc_frame *frame, void *data_out);
+int get_basetemp_dir_entrypoint(struct tplfunc_frame *frame, void *data_out);
+int tox_run_entrypoint(struct tplfunc_frame *frame, void *data_out);
#endif //TEMPLATE_FUNC_PROTO_H \ No newline at end of file
diff --git a/src/lib/core/template.c b/src/lib/core/template.c
index 00e0058..8396b1e 100644
--- a/src/lib/core/template.c
+++ b/src/lib/core/template.c
@@ -26,7 +26,7 @@ extern void tpl_reset() {
tpl_pool_func_used = 0;
}
-void tpl_register_func(char *key, void *tplfunc_ptr, int argc, void *data_in) {
+void tpl_register_func(char *key, tplfunc *tplfunc_ptr, int argc, void *data_in) {
struct tplfunc_frame *frame = calloc(1, sizeof(*frame));
if (!frame) {
SYSERROR("unable to allocate memory for function frame");
diff --git a/src/lib/core/template_func_proto.c b/src/lib/core/template_func_proto.c
index f28a1eb..54a8860 100644
--- a/src/lib/core/template_func_proto.c
+++ b/src/lib/core/template_func_proto.c
@@ -2,7 +2,7 @@
#include "delivery.h"
#include "github.h"
-int get_github_release_notes_tplfunc_entrypoint(void *frame, void *data_out) {
+int get_github_release_notes_tplfunc_entrypoint(struct tplfunc_frame *frame, void *data_out) {
char **output = (char **) data_out;
struct tplfunc_frame *f = (struct tplfunc_frame *) frame;
char *api_token = getenv("STASIS_GH_TOKEN");
@@ -17,7 +17,7 @@ int get_github_release_notes_tplfunc_entrypoint(void *frame, void *data_out) {
return result;
}
-int get_github_release_notes_auto_tplfunc_entrypoint(void *frame, void *data_out) {
+int get_github_release_notes_auto_tplfunc_entrypoint(struct tplfunc_frame *frame, void *data_out) {
int result = 0;
char **output = (char **) data_out;
struct tplfunc_frame *f = (struct tplfunc_frame *) frame;
@@ -68,7 +68,7 @@ int get_github_release_notes_auto_tplfunc_entrypoint(void *frame, void *data_out
return result;
}
-int get_junitxml_file_entrypoint(void *frame, void *data_out) {
+int get_junitxml_file_entrypoint(struct tplfunc_frame *frame, void *data_out) {
int result = 0;
char **output = (char **) data_out;
struct tplfunc_frame *f = (struct tplfunc_frame *) frame;
@@ -95,7 +95,7 @@ int get_junitxml_file_entrypoint(void *frame, void *data_out) {
return result;
}
-int get_basetemp_dir_entrypoint(void *frame, void *data_out) {
+int get_basetemp_dir_entrypoint(struct tplfunc_frame *frame, void *data_out) {
int result = 0;
char **output = (char **) data_out;
struct tplfunc_frame *f = (struct tplfunc_frame *) frame;
@@ -121,7 +121,7 @@ int get_basetemp_dir_entrypoint(void *frame, void *data_out) {
return result;
}
-int tox_run_entrypoint(void *frame, void *data_out) {
+int tox_run_entrypoint(struct tplfunc_frame *frame, void *data_out) {
char **output = (char **) data_out;
struct tplfunc_frame *f = (struct tplfunc_frame *) frame;
const struct Delivery *ctx = (const struct Delivery *) f->data_in;
diff --git a/tests/test_template.c b/tests/test_template.c
index e8f0c1d..3efb142 100644
--- a/tests/test_template.c
+++ b/tests/test_template.c
@@ -95,7 +95,7 @@ void test_tpl_register_func() {
struct testcase {
const char *key;
int argc;
- void *func;
+ tplfunc *func;
};
struct testcase tc[] = {
{.key = "add", .argc = 2, .func = &adder},