Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Side by Side Diff: fusl/src/misc/dirname.c

Issue 1714623002: [fusl] clang-format fusl (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: headers too Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #include <string.h> 1 #include <string.h>
2 #include <libgen.h> 2 #include <libgen.h>
3 3
4 char *dirname(char *s) 4 char* dirname(char* s) {
5 { 5 size_t i;
6 » size_t i; 6 if (!s || !*s)
7 » if (!s || !*s) return "."; 7 return ".";
8 » i = strlen(s)-1; 8 i = strlen(s) - 1;
9 » for (; s[i]=='/'; i--) if (!i) return "/"; 9 for (; s[i] == '/'; i--)
10 » for (; s[i]!='/'; i--) if (!i) return "."; 10 if (!i)
11 » for (; s[i]=='/'; i--) if (!i) return "/"; 11 return "/";
12 » s[i+1] = 0; 12 for (; s[i] != '/'; i--)
13 » return s; 13 if (!i)
14 return ".";
15 for (; s[i] == '/'; i--)
16 if (!i)
17 return "/";
18 s[i + 1] = 0;
19 return s;
14 } 20 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698