From d8dd0f9726034e3a53bc0ee49490bc9f1254b78e Mon Sep 17 00:00:00 2001 From: Niklas Halle Date: Mon, 25 May 2020 21:16:56 +0200 Subject: lots of stuff --- 02_exercise/prompt_utils.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to '02_exercise/prompt_utils.c') diff --git a/02_exercise/prompt_utils.c b/02_exercise/prompt_utils.c index 168c088..751a81b 100644 --- a/02_exercise/prompt_utils.c +++ b/02_exercise/prompt_utils.c @@ -23,26 +23,26 @@ char const *relative_path(char const *const from_dir, char const *const to_dir) } // splitting path into pieces so we can do strcmp on each of them - size_t const *const from_dir_indeces = get_separator_indices(from_dir, '/'); - size_t const *const to_dir_indeces = get_separator_indices(to_dir, '/'); + size_t const *const from_dir_indices = get_separator_indices(from_dir, '/'); + size_t const *const to_dir_indices = get_separator_indices(to_dir, '/'); - size_t from_dir_len = arrayLen(from_dir_indeces); - size_t to_dir_len = arrayLen(to_dir_indeces); + size_t from_dir_len = arrayLen(from_dir_indices); + size_t to_dir_len = arrayLen(to_dir_indices); // finding the longest common substring size_t array_len = from_dir_len < to_dir_len ? from_dir_len : to_dir_len; size_t i = 0; size_t common_position = 0; for (; i < array_len - 1; ++i) { - if (from_dir_indeces[i + 1] != to_dir_indeces[i + 1]) { + if (from_dir_indices[i + 1] != to_dir_indices[i + 1]) { break; } - size_t index = from_dir_indeces[i]; - size_t count = from_dir_indeces[i + 1] - from_dir_indeces[i]; + size_t index = from_dir_indices[i]; + size_t count = from_dir_indices[i + 1] - from_dir_indices[i]; if (strncmp(from_dir + index, to_dir + index, count) != 0) { break; } - common_position = from_dir_indeces[i + 1]; + common_position = from_dir_indices[i + 1]; } size_t levels_up = from_dir_len - i - 1; @@ -67,8 +67,8 @@ char const *relative_path(char const *const from_dir, char const *const to_dir) } } - arrayRelease((void *)from_dir_indeces); - arrayRelease((void *)to_dir_indeces); + arrayRelease((void *)from_dir_indices); + arrayRelease((void *)to_dir_indices); return return_value; } -- cgit v1.2.3-54-g00ecf