From 281b7d84fc5b037531193440594917b10416c971 Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Mon, 12 Feb 2001 18:30:53 +0000
Subject: [PATCH] Add // -> /* */ mapping to pgindent.

---
 contrib/intarray/_int.c              |  8 ++++----
 src/backend/optimizer/util/clauses.c | 12 ++++++------
 src/tools/pgindent/pgindent          |  3 +++
 3 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/contrib/intarray/_int.c b/contrib/intarray/_int.c
index c81e86237ec..a34b36942b2 100644
--- a/contrib/intarray/_int.c
+++ b/contrib/intarray/_int.c
@@ -194,7 +194,7 @@ g_int_compress(GISTENTRY *entry)
 
 #ifdef GIST_DEBUG
     elog(NOTICE, "COMP IN: %d leaf; %d rel; %d page; %d offset; %d bytes; %d elems", entry->leafkey, (int)entry->rel, (int)entry->page, (int)entry->offset, (int)entry->bytes, len);
-    //printarr( r, len );
+    /* printarr( r, len ); */
 #endif
 
     if ( len >= 2*MAXNUMRANGE ) {  /*compress*/
@@ -260,7 +260,7 @@ g_int_decompress(GISTENTRY *entry)
 
 #ifdef GIST_DEBUG
     elog(NOTICE, "DECOMP IN: %d leaf; %d rel; %d page; %d offset; %d bytes; %d elems", entry->leafkey, (int)entry->rel, (int)entry->page, (int)entry->offset, (int)entry->bytes, lenin);
-    //printarr( in, lenin );
+    /* printarr( in, lenin ); */
 #endif
 
     lenr = internal_size(din, lenin);
@@ -653,7 +653,7 @@ inner_int_union ( ArrayType *a, ArrayType *b ) {
 	int i,j;
 
 #ifdef GIST_DEBUG
-    //elog(NOTICE, "inner_union %d %d", ARRISNULL( a ) , ARRISNULL( b ) );
+    /* elog(NOTICE, "inner_union %d %d", ARRISNULL( a ) , ARRISNULL( b ) ); */
 #endif
 
 	if ( ARRISNULL( a ) && ARRISNULL( b ) ) return new_intArrayType(0);
@@ -709,7 +709,7 @@ inner_int_inter ( ArrayType *a, ArrayType *b ) {
 	int i,j;
 
 #ifdef GIST_DEBUG
-    //elog(NOTICE, "inner_inter %d %d", ARRISNULL( a ), ARRISNULL( b ) );
+    /* elog(NOTICE, "inner_inter %d %d", ARRISNULL( a ), ARRISNULL( b ) ); */
 #endif
 
 	if ( ARRISNULL( a ) || ARRISNULL( b ) ) return NULL;
diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c
index f130e257523..faf83dd68db 100644
--- a/src/backend/optimizer/util/clauses.c
+++ b/src/backend/optimizer/util/clauses.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.79 2001/01/24 19:42:59 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.80 2001/02/12 18:30:52 momjian Exp $
  *
  * HISTORY
  *	  AUTHOR			DATE			MAJOR EVENT
@@ -1606,7 +1606,7 @@ simplify_op_or_func(Expr *expr, List *args)
  * {
  *		if (node == NULL)
  *			return false;
- *		// check for nodes that special work is required for, eg:
+ *		# check for nodes that special work is required for, eg:
  *		if (IsA(node, Var))
  *		{
  *			... do special actions for Var nodes
@@ -1615,7 +1615,7 @@ simplify_op_or_func(Expr *expr, List *args)
  *		{
  *			... do special actions for other node types
  *		}
- *		// for any node type not specially processed, do:
+ *		# for any node type not specially processed, do:
  *		return expression_tree_walker(node, my_walker, (void *) context);
  * }
  *
@@ -1659,7 +1659,7 @@ simplify_op_or_func(Expr *expr, List *args)
  *		{
  *			adjust context for subquery;
  *			result = query_tree_walker((Query *) node, my_walker, context,
- *									   true); // to visit subquery RTEs too
+ *									   true); # to visit subquery RTEs too
  *			restore context if needed;
  *			return result;
  *		}
@@ -1909,7 +1909,7 @@ query_tree_walker(Query *query,
  * {
  *		if (node == NULL)
  *			return NULL;
- *		// check for nodes that special work is required for, eg:
+ *		# check for nodes that special work is required for, eg:
  *		if (IsA(node, Var))
  *		{
  *			... create and return modified copy of Var node
@@ -1918,7 +1918,7 @@ query_tree_walker(Query *query,
  *		{
  *			... do special transformations of other node types
  *		}
- *		// for any node type not specially processed, do:
+ *		# for any node type not specially processed, do:
  *		return expression_tree_mutator(node, my_mutator, (void *) context);
  * }
  *
diff --git a/src/tools/pgindent/pgindent b/src/tools/pgindent/pgindent
index 069cf41380e..d47b33e9427 100755
--- a/src/tools/pgindent/pgindent
+++ b/src/tools/pgindent/pgindent
@@ -25,6 +25,9 @@ fi
 for FILE
 do
 	cat $FILE |
+# convert // comments to /* */
+	sed 's;^\([ 	]*\)//\(.*\)$;\1/* \2 */;g' |
+# mark some comments for special treatment later
 	sed 's;/\*  *---;/*---X_X;g' |
 # workaround for indent bug with 'else' handling
 	sed 's;\([} 	]\)else[ 	]*\(/\*.*\)$;\1else\
-- 
GitLab