indent gives unstable output

Alex Bligh <[email protected]> Thu, 12 Sep 2013 15:19:21 +0100
Newsgroups gmane.comp.gnu.indent.bugs
Message-ID <[email protected]>
With the text below, which I have also attached (I realise the mailing
list will probably strip that), indent flips between two states.

This is irritating, as one can't then use indent as a matter of course
before committing to a version control system.

$ indent test.c ; ls -la test.c ; indent test.c ; ls -la test.c ; indent 
test.c ; ls -la test.c ; cp test.c test2.c ; indent test.c ; ls -la test.c 
; diff -u test.c test2.c
-rw-rw-r-- 1 amb amb 765 Sep 12 15:16 test.c
-rw-rw-r-- 1 amb amb 755 Sep 12 15:16 test.c
-rw-rw-r-- 1 amb amb 765 Sep 12 15:16 test.c
-rw-rw-r-- 1 amb amb 755 Sep 12 15:16 test.c
--- test.c	2013-09-12 15:16:07.149612643 +0100
+++ test2.c	2013-09-12 15:16:07.141613168 +0100
@@ -13,10 +13,11 @@
 	  else if (strcasecmp ("SU_PROTO", param_name) == 0)
 	    {
 	      LOG_INFO_MSG ("SU_PROTO is %s, turning it into %d",
-			    (const char *) param_node_val->children[0].
-			    content,
-			    string_to_proto ((const char *) param_node_val->
-					     children[0].content));
+			    (const char *) param_node_val->
+			    children[0].content,
+			    string_to_proto ((const char *)
+					     param_node_val->children[0].
+					     content));
 	      unit->protocol = string_to_proto ((const char *) 
param_node_val->children[0].content);	//get_param_val (param_node_val);

 	    }

-- 
Alex Bligh

$ cat test.c
load_storage_unit (const char *u_name)
{
  for (param_node_val = root_element->children; param_node_val;
       param_node_val = param_node_val->next)
    {
      if (param_node_val->type == XML_ELEMENT_NODE)
	{
	  if (strcasecmp ("SU_NAME", param_name) == 0)
	    {
	      unit->unit_name = get_param_val (param_node_val);

	    }
	  else if (strcasecmp ("SU_PROTO", param_name) == 0)
	    {
	      LOG_INFO_MSG ("SU_PROTO is %s, turning it into %d",
			    (const char *) param_node_val->children[0].
			    content,
			    string_to_proto ((const char *) param_node_val->
					     children[0].content));
	      unit->protocol = string_to_proto ((const char *) 
param_node_val->children[0].content);	//get_param_val (param_node_val);

	    }
	}
    }
}

_______________________________________________
bug-indent mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-indent
test.c (text/plain, 755 B)
load_storage_unit (const char *u_name)
{
  for (param_node_val = root_element->children; param_node_val;
       param_node_val = param_node_val->next)
    {
      if (param_node_val->type == XML_ELEMENT_NODE)
	{
	  if (strcasecmp ("SU_NAME", param_name) == 0)
	    {
	      unit->unit_name = get_param_val (param_node_val);

	    }
	  else if (strcasecmp ("SU_PROTO", param_name) == 0)
	    {
	      LOG_INFO_MSG ("SU_PROTO is %s, turning it into %d",
			    (const char *) param_node_val->children[0].
			    content,
			    string_to_proto ((const char *) param_node_val->
					     children[0].content));
	      unit->protocol = string_to_proto ((const char *) param_node_val->children[0].content);	//get_param_val (param_node_val);

	    }
	}
    }
}