Mercurial
diff hg-web/main.c @ 188:32ce881452fa hg-web
Fixing few stuff.
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Fri, 23 Jan 2026 22:50:28 -0800 |
| parents | 71ad34a8bc9a |
| children | a2725419f988 |
line wrap: on
line diff
--- a/hg-web/main.c Fri Jan 23 22:41:04 2026 -0800 +++ b/hg-web/main.c Fri Jan 23 22:50:28 2026 -0800 @@ -19,9 +19,9 @@ { if (!input_path || strlen(input_path) == 0) { - char *empty = Dowa_Arena_Allocate(arena, 1); - empty[0] = '\0'; - return empty; + char *empty = Dowa_Arena_Allocate(arena, 1); + empty[0] = '\0'; + return empty; } size_t len = strlen(input_path); @@ -30,11 +30,13 @@ for (size_t i = 0; i < len; i++) { - if (input_path[i] == '.' && (i == 0 || input_path[i-1] == '/')) { - if (i + 1 < len && input_path[i+1] == '.') { - // Skip ".." - i++; - continue; + if (input_path[i] == '.' && (i == 0 || input_path[i-1] == '/')) + { + if (i + 1 < len && input_path[i+1] == '.') + { + // Skip ".." + i++; + continue; } // Skip "." continue; @@ -45,9 +47,9 @@ // Remove leading/trailing slashes while (result[0] == '/') - memmove(result, result + 1, strlen(result)); + memmove(result, result + 1, strlen(result)); while (j > 0 && result[j-1] == '/') - result[--j] = '\0'; + result[--j] = '\0'; return result; }