From 821bb908112ca161547e9ec96fa7bba8ee38e88d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Tue, 29 May 2001 19:17:48 +0200
Subject: [PATCH] Bugfix of cpp().

Rev: src/cpp.c:1.86
Rev: src/preprocessor.h:1.41
---
 src/cpp.c          |  4 ++--
 src/preprocessor.h | 11 ++++++-----
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/cpp.c b/src/cpp.c
index 871fc3482e..89ec7d77dd 100644
--- a/src/cpp.c
+++ b/src/cpp.c
@@ -5,7 +5,7 @@
 \*/
 
 /*
- * $Id: cpp.c,v 1.85 2001/05/29 16:48:20 grubba Exp $
+ * $Id: cpp.c,v 1.86 2001/05/29 17:17:48 grubba Exp $
  */
 #include "global.h"
 #include "stralloc.h"
@@ -84,7 +84,7 @@ struct define
   magic_define_fun magic;
   int args;
   ptrdiff_t num_parts;
-  short inside;
+  short inside;		/* 1 - Don't expand. 2 - In use. */
   short varargs;
   struct pike_string *first;
   struct define_part parts[1];
diff --git a/src/preprocessor.h b/src/preprocessor.h
index 00e688d903..34e2a79d0f 100644
--- a/src/preprocessor.h
+++ b/src/preprocessor.h
@@ -1,5 +1,5 @@
 /*
- * $Id: preprocessor.h,v 1.40 2001/05/29 16:48:21 grubba Exp $
+ * $Id: preprocessor.h,v 1.41 2001/05/29 17:17:48 grubba Exp $
  *
  * Preprocessor template.
  * Based on cpp.c 1.45
@@ -877,12 +877,13 @@ static ptrdiff_t lower_cpp(struct cpp *this,
 	  }
 	}
 	  
-	if(d && !d->inside)
+	if(d && !(d->inside & 1))
 	{
 	  int arg=0;
 	  INT32 startline = this->current_line;
 	  struct string_builder tmp;
 	  struct define_argument arguments [MAX_ARGS];
+	  short inside = d->inside;
 	  
 	  if(s) add_ref(s);
 	  
@@ -1033,11 +1034,11 @@ static ptrdiff_t lower_cpp(struct cpp *this,
 		  INT32 line=this->current_line;
 		  save=this->buf;
 		  this->buf=tmp;
-		  d->inside = 1;
+		  d->inside = 2;
 		  lower_cpp(this, a, l,
 			    flags & ~(CPP_EXPECT_ENDIF | CPP_EXPECT_ELSE),
 			    auto_convert, charset);
-		  d->inside = 0;
+		  d->inside = inside;
 		  tmp=this->buf;
 		  this->buf=save;
 		  this->current_line=line;
@@ -1074,7 +1075,7 @@ static ptrdiff_t lower_cpp(struct cpp *this,
 	  if(s)
 	  {
 	    if((d=find_define(s)))
-	      d->inside=0;
+	      d->inside = inside;
 	    
 	    free_string(s);
 	  }
-- 
GitLab