@codebrainz commented on this pull request.
> + /* get last path_delimiter so we know the path */
+ int i;
+ int last_path_delimiter;
+ for (i = 0; locale_filename[i] != '\0'; ++i) {
+ if (locale_filename[i] == path_delimiter) {
+ last_path_delimiter = i;
+ }
+ }
+
+ /* get substring containing only the filename path */
+ gchar *filename_path = g_malloc((last_path_delimiter +
2) * sizeof(char));
+ strncpy(filename_path, locale_filename,
last_path_delimiter + 1);
+ filename_path[last_path_delimiter + 1] = '\0';
If I understand correctly the intention here, I believe these lines could be
reduced to:
```c
gchar *filename_path = g_path_get_dirname(locale_filename);
```
GLib makes C quite a bit less painful :wink:
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/2586#pullrequestreview-488264298