[llvm-commits] CVS: llvm/lib/System/Unix/Path.inc
Reid Spencer
reid at x10sys.com
Thu Jul 7 23:03:01 PDT 2005
Jeff,
The contract the Path class makes with its users is that it will never
permit a syntactically invalid path to be constructed. With this patch
you have violated that guarantee. What was the objective of this patch?
Reid.
On Thu, 2005-07-07 at 23:49 -0500, Jeff Cohen wrote:
>
> 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
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://mail.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20050707/eddf61f8/attachment.sig>
More information about the llvm-commits
mailing list