From 00bea804e2fe2151ff0731c95e5fe6b1c23e2941 Mon Sep 17 00:00:00 2001 From: John Hernandez <129467592+H3rnand3zzz@users.noreply.github.com> Date: Wed, 5 Jul 2023 18:40:18 +0200 Subject: [PATCH] Improve documentation two functions Namely `cmd_process_input()` and `files_get_data_path()`. Edited by @jubalh. --- src/command/cmd_funcs.c | 7 +++++++ src/config/files.c | 13 +++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index cf3c2492..848da549 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -188,6 +188,13 @@ _string_matches_one_of(const char* what, const char* is, bool is_can_be_null, co return ret; } +/** + * @brief Processes a line of input and determines if profanity should continue. + * + * @param window + * @param inp The input string to process. + * @return Returns TRUE if profanity is to continue, FALSE otherwise. + */ gboolean cmd_process_input(ProfWin* window, char* inp) { diff --git a/src/config/files.c b/src/config/files.c index 6724a0ba..a7a10162 100644 --- a/src/config/files.c +++ b/src/config/files.c @@ -155,11 +155,20 @@ files_get_config_path(const char* const config_base) return result; } +/** + * Get the full path by appending the given location to the project base path. + * + * @param location The location (directory or file) to append to the project base path. + * @return The full path obtained by appending the location to the project base path. + * + * @note The returned value must be freed using g_free when it is no longer needed + * to prevent memory leaks. + */ gchar* -files_get_data_path(const char* const data_base) +files_get_data_path(const char* const location) { auto_gchar gchar* xdg_data = _files_get_xdg_data_home(); - gchar* result = g_strdup_printf("%s/profanity/%s", xdg_data, date_base); + gchar* result = g_strdup_printf("%s/profanity/%s", xdg_data, location); return result; }