[[PATCH setup] 1/3] Remove the function filemanip.cc:base
Ken Brown
kbrown@cornell.edu
Fri Oct 27 18:47:00 GMT 2017
This was called only on plain filenames, not full pathnames, so it was
not needed. Moreover, it wasn't correctly handling filenames
containing colons.
---
filemanip.cc | 18 +-----------------
filemanip.h | 1 -
2 files changed, 1 insertion(+), 18 deletions(-)
diff --git a/filemanip.cc b/filemanip.cc
index d1d27be..265a2a7 100644
--- a/filemanip.cc
+++ b/filemanip.cc
@@ -43,22 +43,6 @@ get_file_size (const std::string& name)
return rv;
}
-std::string
-base (const std::string& aString)
-{
- if (!aString.size())
- return "";
- const char *s = aString.c_str();
- std::string rv = s;
- while (*s)
- {
- if ((*s == '/' || *s == ':' || *s == '\\') && s[1])
- rv = s + 1;
- s++;
- }
- return rv;
-}
-
/* returns the number of characters of path that
* precede the extension
*/
@@ -89,7 +73,7 @@ parse_filename (const string &fn, fileparse & f)
f.tail = fn.substr (n, string::npos);
- p = new_cstr_char_array (base (fn.substr (0, n)));
+ p = new_cstr_char_array (fn.substr (0, n));
char const *ext;
/* TODO: make const and non-const trail variant. */
if ((ext = trail (p, "-src")))
diff --git a/filemanip.h b/filemanip.h
index 5594519..451211f 100644
--- a/filemanip.h
+++ b/filemanip.h
@@ -30,7 +30,6 @@ struct fileparse
};
int parse_filename (const std::string& fn, fileparse & f);
-std::string base (const std::string& );
size_t get_file_size (const std::string& );
std::string backslash (const std::string& s);
const char * trail (const char *, const char *);
--
2.14.2
More information about the Cygwin-apps
mailing list