refactor: rename argument to avoid C++ keyword conflict
All checks were successful
CI / Check coding style (pull_request) Successful in 36s
CI / Check spelling (pull_request) Successful in 19s
CI / Linux (debian) (pull_request) Successful in 9m52s
CI / Linux (ubuntu) (pull_request) Successful in 10m13s
CI / Linux (arch) (pull_request) Successful in 17m15s
All checks were successful
CI / Check coding style (pull_request) Successful in 36s
CI / Check spelling (pull_request) Successful in 19s
CI / Linux (debian) (pull_request) Successful in 9m52s
CI / Linux (ubuntu) (pull_request) Successful in 10m13s
CI / Linux (arch) (pull_request) Successful in 17m15s
The parameter `template` in format_call_external_argv() was renamed to `template_fmt` to avoid collision with the `template` keyword in C++. This improves compatibility when the header is included in C++ code.
This commit is contained in:
14
src/common.c
14
src/common.c
@@ -655,17 +655,17 @@ call_external(gchar** argv)
|
|||||||
*
|
*
|
||||||
* This function constructs an argument vector (argv) based on the provided template string, replacing placeholders ("%u" and "%p") with the provided URL and filename, respectively.
|
* This function constructs an argument vector (argv) based on the provided template string, replacing placeholders ("%u" and "%p") with the provided URL and filename, respectively.
|
||||||
*
|
*
|
||||||
* @param template The template string with placeholders.
|
* @param template_fmt The template string with placeholders.
|
||||||
* @param url The URL to replace "%u" (or NULL to skip).
|
* @param url The URL to replace "%u" (or NULL to skip).
|
||||||
* @param filename The filename to replace "%p" (or NULL to skip).
|
* @param filename The filename to replace "%p" (or NULL to skip).
|
||||||
* @return The constructed argument vector (argv) as a null-terminated array of strings.
|
* @return The constructed argument vector (argv) as a null-terminated array of strings.
|
||||||
*
|
*
|
||||||
* @note Remember to free the returned argument vector using `auto_gcharv` or `g_strfreev()`.
|
* @note Remember to free the returned argument vector using `auto_gcharv` or `g_strfreev()`.
|
||||||
*/
|
*/
|
||||||
gchar**
|
gchar**
|
||||||
format_call_external_argv(const char* template, const char* url, const char* filename)
|
format_call_external_argv(const char* template_fmt, const char* url, const char* filename)
|
||||||
{
|
{
|
||||||
gchar** argv = g_strsplit(template, " ", 0);
|
gchar** argv = g_strsplit(template_fmt, " ", 0);
|
||||||
|
|
||||||
guint num_args = 0;
|
guint num_args = 0;
|
||||||
while (argv[num_args]) {
|
while (argv[num_args]) {
|
||||||
@@ -674,7 +674,7 @@ format_call_external_argv(const char* template, const char* url, const char* fil
|
|||||||
argv[num_args] = g_strdup(url);
|
argv[num_args] = g_strdup(url);
|
||||||
} else if (0 == g_strcmp0(argv[num_args], "%p") && filename != NULL) {
|
} else if (0 == g_strcmp0(argv[num_args], "%p") && filename != NULL) {
|
||||||
g_free(argv[num_args]);
|
g_free(argv[num_args]);
|
||||||
argv[num_args] = strdup(filename);
|
argv[num_args] = g_strdup(filename);
|
||||||
}
|
}
|
||||||
num_args++;
|
num_args++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ void get_file_paths_recursive(const char* directory, GSList** contents);
|
|||||||
char* get_random_string(int length);
|
char* get_random_string(int length);
|
||||||
|
|
||||||
gboolean call_external(gchar** argv);
|
gboolean call_external(gchar** argv);
|
||||||
gchar** format_call_external_argv(const char* template, const char* url, const char* filename);
|
gchar** format_call_external_argv(const char* template_fmt, const char* url, const char* filename);
|
||||||
|
|
||||||
gchar* unique_filename_from_url(const char* url, const char* path);
|
gchar* unique_filename_from_url(const char* url, const char* path);
|
||||||
gchar* get_expanded_path(const char* path);
|
gchar* get_expanded_path(const char* path);
|
||||||
|
|||||||
Reference in New Issue
Block a user