Jump to content

Talk:Find common directory path: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 39:
It is intended to work that way, and it works with "dovetail" also. The first conditional handles cases both with and without terminating slash. Try it. [[User:Per|Per]] 12:07, 14 April 2011 (UTC)
 
:ok, yes, nevermind. And the case I was worried about would have appeared with the provided example but is dealt with by a prior test. However, that does not mean that the algorithm is completely valid. Consider, for example, what happens if you change an instance of "home" to "hone". Here's my proposed alternative: <lang c>static void longestSharedPath(const char *fixed, char *moving) {
char *t;
unsigned n = 0;
6,962

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.