I wanted to make use of cwk_path_get_basename() for a project of mine in order to strip the directory chain from a path and just keep the file name and extension. The function call works for this, but I had to provide a length variable even though I didn't need to use the length.
This PR modifies the function slightly so that length can safely be passed as NULL if the caller does not need it. I didn't think this change would be worth adding to other functions, as the purpose of the others is generally to extract a segment from the middle of the path, rather than trimming it.
I wanted to make use of
cwk_path_get_basename()
for a project of mine in order to strip the directory chain from a path and just keep the file name and extension. The function call works for this, but I had to provide a length variable even though I didn't need to use the length.This PR modifies the function slightly so that
length
can safely be passed asNULL
if the caller does not need it. I didn't think this change would be worth adding to other functions, as the purpose of the others is generally to extract a segment from the middle of the path, rather than trimming it.