diff options
author | John Schmidt <john.schmidt.h@gmail.com> | 2014-03-31 00:39:52 +0200 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-04-01 08:08:07 -0300 |
commit | 2a6df95fb533fd451b9b13ec15ae8c1437e048ca (patch) | |
tree | 63bc4591a4be6e9846a04e6c9530216544b668a3 /src | |
parent | e29e9563480946e13252f5aea6a9d137c9483a61 (diff) | |
download | rneovim-2a6df95fb533fd451b9b13ec15ae8c1437e048ca.tar.gz rneovim-2a6df95fb533fd451b9b13ec15ae8c1437e048ca.tar.bz2 rneovim-2a6df95fb533fd451b9b13ec15ae8c1437e048ca.zip |
Move same_directory from misc2.c
Diffstat (limited to 'src')
-rw-r--r-- | src/misc2.c | 21 | ||||
-rw-r--r-- | src/misc2.h | 1 | ||||
-rw-r--r-- | src/path.c | 21 | ||||
-rw-r--r-- | src/path.h | 1 |
4 files changed, 22 insertions, 22 deletions
diff --git a/src/misc2.c b/src/misc2.c index 2ca42fee03..1a3d315899 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -1613,27 +1613,6 @@ int get_real_state(void) return State; } -/* - * Return TRUE if file names "f1" and "f2" are in the same directory. - * "f1" may be a short name, "f2" must be a full path. - */ -int same_directory(char_u *f1, char_u *f2) -{ - char_u ffname[MAXPATHL]; - char_u *t1; - char_u *t2; - - /* safety check */ - if (f1 == NULL || f2 == NULL) - return FALSE; - - (void)vim_FullName(f1, ffname, MAXPATHL, FALSE); - t1 = gettail_sep(ffname); - t2 = gettail_sep(f2); - return t1 - ffname == t2 - f2 - && pathcmp((char *)ffname, (char *)f2, (int)(t1 - ffname)) == 0; -} - #if defined(FEAT_SESSION) || defined(MSWIN) || defined(FEAT_GUI_MAC) \ || ((defined(FEAT_GUI_GTK)) \ && ( defined(FEAT_WINDOWS) || defined(FEAT_DND)) ) \ diff --git a/src/misc2.h b/src/misc2.h index abf74db192..44c0a8be0f 100644 --- a/src/misc2.h +++ b/src/misc2.h @@ -68,7 +68,6 @@ void set_fileformat(int t, int opt_flags); int default_fileformat(void); int call_shell(char_u *cmd, ShellOpts opts, char_u *extra_shell_arg); int get_real_state(void); -int same_directory(char_u *f1, char_u *f2); int vim_chdirfile(char_u *fname); int illegal_slash(char *name); int vim_chdir(char_u *new_dir); diff --git a/src/path.c b/src/path.c index 078c26467a..bfd21b426c 100644 --- a/src/path.c +++ b/src/path.c @@ -1673,3 +1673,24 @@ int after_pathsep(char_u *b, char_u *p) && (!has_mbyte || (*mb_head_off)(b, p - 1) == 0); } +/* + * Return TRUE if file names "f1" and "f2" are in the same directory. + * "f1" may be a short name, "f2" must be a full path. + */ +int same_directory(char_u *f1, char_u *f2) +{ + char_u ffname[MAXPATHL]; + char_u *t1; + char_u *t2; + + /* safety check */ + if (f1 == NULL || f2 == NULL) + return FALSE; + + (void)vim_FullName(f1, ffname, MAXPATHL, FALSE); + t1 = gettail_sep(ffname); + t2 = gettail_sep(f2); + return t1 - ffname == t2 - f2 + && pathcmp((char *)ffname, (char *)f2, (int)(t1 - ffname)) == 0; +} + diff --git a/src/path.h b/src/path.h index 3a5384fbb1..6ccbab9c40 100644 --- a/src/path.h +++ b/src/path.h @@ -32,4 +32,5 @@ int vim_isAbsName(char_u *name); int vim_FullName(char_u *fname, char_u *buf, int len, int force); char_u *fix_fname(char_u *fname); int after_pathsep(char_u *b, char_u *p); +int same_directory(char_u *f1, char_u *f2); #endif |