@eht16 commented on this pull request.


> + *                    'e' : replace %e with the filename (excluding 
> extension)
+ *                    'f' : replace %f with the filename (including extension)
+ *                    'p' : replace %p with the absolute path/filename 
(including extension)
+ *                    e.g. 'df' will replace all %d and %f placeholders
+ * @param[in] filename The filename that replaces occurrences of the 
placeholder.
+ *
+ * @return `TRUE` if the replacement was successful, `FALSE` if an error 
occurred.
+ *
+ * @note The caller is responsible for ensuring that `haystack` has enough 
memory
+ *       allocated to accommodate the modified string if necessary.
+ *
+ * @note Character repetitions in the needles string is accepted but sloppy on 
the edges
+ *
+ * @note Invalid characters in the needles string will be ignored
+ */
+gboolean utils_replace_placeholder(gchar **haystack, const gchar *needles, 
gchar *filename)

Why didn't you just re-use `build_replace_placeholder()` and instead wrote it 
completely new?

Can't we just rename `build_replace_placeholder()` to 
`utils_replace_filename_placeholders() and move it to `src/utils.c`?

The existing code returns a newly allocated strings which is nicer than having 
the caller to pre-allocate it, I think.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/4250#pullrequestreview-2727926500
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany/pull/4250/review/2727926...@github.com>

Reply via email to