[Github-comments] [geany/geany] Use strchr instead of strstr (PR #2962)
elextr
notifications at xxxxx
Thu Nov 25 07:42:45 UTC 2021
@andy5995 that would still have the string constant in two places, if it really was worth doing do it like:
```c
static char ed[] = "Entering Directory";
..
pos = strstr(string, ed);
..
strchr(pos + sizeof ed - 1, '/')
```
Note the -1 to account for the end NUL.
--
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/2962#issuecomment-978914882
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20211124/266484f8/attachment.htm>
More information about the Github-comments
mailing list