diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2023-11-20 10:05:48 -0500 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2023-11-20 10:05:48 -0500 |
commit | 243d8540b3869f9ace2baf8b00f9cb86e8d84d52 (patch) | |
tree | dbb3566b4d1e750008ba40c0800d9bd55a9774cc /include/utils.h | |
parent | d377b6fd45fbffe3d57ce3486853938e45bebaf4 (diff) | |
download | stasis-243d8540b3869f9ace2baf8b00f9cb86e8d84d52.tar.gz |
Fix warnings and add xmkstemp
* Reduce stack usage for status variable in msg()
* Bugfix: write OMC_COLOR_RESET to the requested stream instead of stdout
* Add helper function xmkstemp to avoid clutter when using disposable files
Diffstat (limited to 'include/utils.h')
-rw-r--r-- | include/utils.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/utils.h b/include/utils.h index 15684e8..f815c12 100644 --- a/include/utils.h +++ b/include/utils.h @@ -45,5 +45,14 @@ char *git_describe(const char *path); void msg(unsigned type, char *fmt, ...); void debug_shell(); +/** + * Creates a temporary file returning an open file pointer via @a fp, and the + * path to the file. The caller is responsible for closing @a fp and + * free()ing the returned file path. + * @param fp pointer to FILE (to be initialized) + * @return system path to the temporary file + * @return NULL on failure + */ +char *xmkstemp(FILE **fp); #endif //OMC_UTILS_H |