From 89b83ea9157f400b1c0528d651c8826148e7c56b Mon Sep 17 00:00:00 2001
From: Marcus Comstedt <marcus@mc.pp.se>
Date: Sun, 29 Jun 2008 14:40:47 +0200
Subject: [PATCH] __DIR__ now uses dirname() instead of combine_path(,"..").

Rev: src/cpp.c:1.175
Rev: src/testsuite.in:1.834
---
 src/cpp.c        | 15 ++-------------
 src/testsuite.in | 10 ++--------
 2 files changed, 4 insertions(+), 21 deletions(-)

diff --git a/src/cpp.c b/src/cpp.c
index 42bb50fbf6..97185ade94 100644
--- a/src/cpp.c
+++ b/src/cpp.c
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: cpp.c,v 1.174 2008/06/13 21:14:28 marcus Exp $
+|| $Id: cpp.c,v 1.175 2008/06/29 12:40:47 marcus Exp $
 */
 
 #include "global.h"
@@ -1507,18 +1507,7 @@ static void insert_current_dir_as_string(struct cpp *this,
                                          struct string_builder *tmp)
 {
   ref_push_string(this->current_file);
-#ifdef __NT__
-  push_constant_text("..");
-  f_combine_path_nt(2);
-#else
-#ifdef __amigaos__
-  push_constant_text("/");
-  f_combine_path_amigaos(2);
-#else
-  push_constant_text("..");
-  f_combine_path_unix(2);
-#endif
-#endif
+  SAFE_APPLY_MASTER("dirname",1);
   PUSH_STRING_SHIFT(Pike_sp[-1].u.string->str, Pike_sp[-1].u.string->len,
                     Pike_sp[-1].u.string->size_shift, tmp);
   pop_stack();
diff --git a/src/testsuite.in b/src/testsuite.in
index a9887b251f..19fce8227c 100644
--- a/src/testsuite.in
+++ b/src/testsuite.in
@@ -1,5 +1,5 @@
 START_MARKER
-test_true([["$Id: testsuite.in,v 1.833 2008/06/28 17:18:37 nilsson Exp $"]]);
+test_true([["$Id: testsuite.in,v 1.834 2008/06/29 12:40:47 marcus Exp $"]]);
 
 // This triggered a bug only if run sufficiently early.
 test_compile_any([[#pike 7.2]])
@@ -8500,13 +8500,7 @@ test_true( rm("conftest.h") )
 
 test_true(intp(__LINE__))
 test_true(stringp(__FILE__))
-test_eq(combine_path(__FILE__,
-#ifdef __amigaos__
-"/"
-#else
-".."
-#endif
-),__DIR__)
+test_eq(dirname(__FILE__),__DIR__)
 test_true(stringp(__DATE__))
 test_true([[ sscanf(__DATE__, "%3s %d %d", string m, int d, int y) == 3 &&
 	     search(({"Jan", "Feb", "Mar", "Apr", "May", "Jun",
-- 
GitLab