[llvm-commits] CVS: llvm/lib/System/Unix/Path.inc
Jeff Cohen
jeffc at jolt-lang.org
Thu Jul 7 21:49:27 PDT 2005
Changes in directory llvm/lib/System/Unix:
Path.inc updated: 1.38 -> 1.39
---
Log message:
Fix eraseSuffix()
---
Diffs of the changes: (+6 -10)
Path.inc | 16 ++++++----------
1 files changed, 6 insertions(+), 10 deletions(-)
Index: llvm/lib/System/Unix/Path.inc
diff -u llvm/lib/System/Unix/Path.inc:1.38 llvm/lib/System/Unix/Path.inc:1.39
--- llvm/lib/System/Unix/Path.inc:1.38 Thu Jul 7 22:08:58 2005
+++ llvm/lib/System/Unix/Path.inc Thu Jul 7 23:49:16 2005
@@ -504,19 +504,15 @@
bool
Path::eraseSuffix() {
- std::string save(path);
size_t dotpos = path.rfind('.',path.size());
size_t slashpos = path.rfind('/',path.size());
- if (slashpos != std::string::npos &&
- dotpos != std::string::npos &&
- dotpos > slashpos) {
- path.erase(dotpos, path.size()-dotpos);
- }
- if (!isValid()) {
- path = save;
- return false;
+ if (dotpos != std::string::npos) {
+ if (slashpos == std::string::npos || dotpos > slashpos) {
+ path.erase(dotpos, path.size()-dotpos);
+ return true;
+ }
}
- return true;
+ return false;
}
bool
More information about the llvm-commits
mailing list