diff options
| author | Joseph Hunkeler <jhunkeler@users.noreply.github.com> | 2026-05-12 13:34:13 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-12 13:34:13 -0400 |
| commit | d8ee8c27444a56bb98dd8bd67a019a1e9efbcc10 (patch) | |
| tree | 6ae1275a5f8e5794b917aac95c6cb1ab3f4cb6c5 /src/lib/core/include | |
| parent | 4649a889a916aa377ebd3ca8f3daa9ac703baa34 (diff) | |
| parent | 1d91efc28e30c8501428fec8ff6cd7b13dcdfb95 (diff) | |
| download | stasis-master.tar.gz | |
Bughunt 0x1002
Diffstat (limited to 'src/lib/core/include')
| -rw-r--r-- | src/lib/core/include/log.h | 2 | ||||
| -rw-r--r-- | src/lib/core/include/template.h | 7 | ||||
| -rw-r--r-- | src/lib/core/include/template_func_proto.h | 10 | ||||
| -rw-r--r-- | src/lib/core/include/utils.h | 20 |
4 files changed, 25 insertions, 14 deletions
diff --git a/src/lib/core/include/log.h b/src/lib/core/include/log.h index 18617c4..cad954f 100644 --- a/src/lib/core/include/log.h +++ b/src/lib/core/include/log.h @@ -16,7 +16,7 @@ struct ExecPoint { const char *function; // function of origin }; -#define EXECPOINT (struct ExecPoint) {.line = __LINE__, .file = __FILE__, .function = __FUNCTION__} +#define EXECPOINT (struct ExecPoint) {.line = __LINE__, .file = __FILE__, .function = __func__} void log_print_error(struct ExecPoint ep, const char *fmt, ...); void log_print_warning(struct ExecPoint ep, const char *fmt, ...); 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/include/utils.h b/src/lib/core/include/utils.h index 1a5e97f..98b8ae8 100644 --- a/src/lib/core/include/utils.h +++ b/src/lib/core/include/utils.h @@ -210,17 +210,17 @@ int path_store(char **destptr, size_t maxlen, const char *base, const char *path #define STASIS_COLOR_RESET "" #else //! Set output color to red -#define STASIS_COLOR_RED "\e[1;91m" +#define STASIS_COLOR_RED "\x1b[1;91m" //! Set output color to green -#define STASIS_COLOR_GREEN "\e[1;92m" +#define STASIS_COLOR_GREEN "\x1b[1;92m" //! Set output color to yellow -#define STASIS_COLOR_YELLOW "\e[1;93m" +#define STASIS_COLOR_YELLOW "\x1b[1;93m" //! Set output color to blue -#define STASIS_COLOR_BLUE "\e[1;94m" +#define STASIS_COLOR_BLUE "\x1b[1;94m" //! Set output color to white -#define STASIS_COLOR_WHITE "\e[1;97m" +#define STASIS_COLOR_WHITE "\x1b[1;97m" //! Reset output color to terminal default -#define STASIS_COLOR_RESET "\e[0;37m\e[0m" +#define STASIS_COLOR_RESET "\x1b[0;37m\x1b[0m" #endif #define STASIS_MSG_SUCCESS 0 @@ -484,4 +484,12 @@ int str_to_timeout(char *s); const char *get_random_generator_file(); int get_random_bytes(char *result, size_t maxlen); +/** + * Get length of `s` as if any formatters are not present + * @param s format string + * @return length + */ +int non_format_len(const char *s); + +char *center_text(const char *s, size_t maxwidth); #endif //STASIS_UTILS_H |
