Strange formatting with indent

Alex Bligh <[email protected]> Sun, 24 Jul 2011 13:56:50 +0100
Newsgroups gmane.comp.gnu.indent.bugs
Message-ID <[email protected]>
If I feed indent (with no settings, so standard GNU format) the C
structure below, it comes out with rather peculiar output.

Two things are noticeable:

1. the pointers to functions which return a ssize_t are indented by
   more than the others. This is the real ugliness.

2. For some reason we have "char *objname" and "void *buf" but
   "struct frobbit * bar" and "wobjob_t * objlist". Is the
   inconsistency of the space after the * deliberate?

-- 
Alex Bligh


$ cat test.h
typedef struct foobar
{
char*barbaz;
int(*init)(struct frobbit*bar);
void(*deinit)(struct frobbit*bar);
ssize_t(*read)(struct frobbit*bar,char*objname,void*buf,size_t count);
ssize_t(*write)(struct frobbit*bar,char*objname,void*buf,size_t count);
int(*mkdir)(struct frobbit*bar,char*objname);
ssize_t(*getsize)(struct frobbit*bar,char*objname);
int(*alongname)(struct frobbit*bar,char*objname,wobjob_t*objlist);
char*(*anotherlongname)(struct frobbit*bar,char*objname);
struct foobar*next;
struct foobar*prev;
}foobar_t;

$ indent < test.h
typedef struct foobar
{
  char *barbaz;
  int (*init) (struct frobbit * bar);
  void (*deinit) (struct frobbit * bar);
    ssize_t (*read) (struct frobbit * bar, char *objname, void *buf,
		     size_t count);
    ssize_t (*write) (struct frobbit * bar, char *objname, void *buf,
		      size_t count);
  int (*mkdir) (struct frobbit * bar, char *objname);
    ssize_t (*getsize) (struct frobbit * bar, char *objname);
  int (*alongname) (struct frobbit * bar, char *objname, wobjob_t * 
objlist);
  char *(*anotherlongname) (struct frobbit * bar, char *objname);
  struct foobar *next;
  struct foobar *prev;
} foobar_t;