Skip to content

Commit

Permalink
remove unused mutt_path_pretty()
Browse files Browse the repository at this point in the history
  • Loading branch information
roccoblues authored and flatcap committed Nov 2, 2023
1 parent 097fd56 commit dc6829e
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 122 deletions.
36 changes: 0 additions & 36 deletions mutt/path.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,42 +176,6 @@ bool mutt_path_tidy(struct Buffer *path, bool is_dir)
return true;
}

/**
* mutt_path_pretty - Tidy a filesystem path
* @param path Path to modify
* @param homedir Home directory for '~' substitution
* @param is_dir Is the path a directory?
* @retval true Success
*
* Tidy a path and replace a home directory with '~'
*/
bool mutt_path_pretty(struct Buffer *path, const char *homedir, bool is_dir)
{
if (buf_is_empty(path))
return false;

mutt_path_tidy(path, is_dir);

size_t len = mutt_str_startswith(path->data, homedir);
if (len == 0)
return false;

if ((buf_at(path, len) != '/') && (buf_at(path, len) != '\0'))
return false;

path->data[0] = '~';
if (buf_len(path) == len)
{
path->data[1] = '\0';
buf_fix_dptr(path);
return true;
}

mutt_str_copy(path->data + 1, path->data + len, buf_len(path) + 1 - len);
buf_fix_dptr(path);
return true;
}

/**
* mutt_path_tilde - Expand '~' in a path
* @param path Path to modify
Expand Down
1 change: 0 additions & 1 deletion mutt/path.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ char * mutt_path_dirname(const char *path);
char * mutt_path_escape(const char *src);
const char *mutt_path_getcwd(struct Buffer *cwd);
bool mutt_path_parent(struct Buffer *path);
bool mutt_path_pretty(struct Buffer *path, const char *homedir, bool is_dir);
size_t mutt_path_realpath(struct Buffer *path);
bool mutt_path_tidy(struct Buffer *path, bool is_dir);
bool mutt_path_tidy_dotdot(char *buf);
Expand Down
1 change: 0 additions & 1 deletion test/Makefile.autosetup
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,6 @@ PATH_OBJS = test/path/mutt_path_abbr_folder.o \
test/path/mutt_path_escape.o \
test/path/mutt_path_getcwd.o \
test/path/mutt_path_parent.o \
test/path/mutt_path_pretty.o \
test/path/mutt_path_realpath.o \
test/path/mutt_path_tidy.o \
test/path/mutt_path_tidy_dotdot.o \
Expand Down
1 change: 0 additions & 1 deletion test/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,6 @@ void test_fini(void);
NEOMUTT_TEST_ITEM(test_mutt_path_escape) \
NEOMUTT_TEST_ITEM(test_mutt_path_getcwd) \
NEOMUTT_TEST_ITEM(test_mutt_path_parent) \
NEOMUTT_TEST_ITEM(test_mutt_path_pretty) \
NEOMUTT_TEST_ITEM(test_mutt_path_realpath) \
NEOMUTT_TEST_ITEM(test_mutt_path_tidy) \
NEOMUTT_TEST_ITEM(test_mutt_path_tidy_dotdot) \
Expand Down
83 changes: 0 additions & 83 deletions test/path/mutt_path_pretty.c

This file was deleted.

0 comments on commit dc6829e

Please sign in to comment.