Re: [PATCH v4 15/15] daemon: opt-out on features that require posix

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH v4 15/15] daemon: opt-out on features that require posix

From: Andreas Schwab <hidden>
Date: 2016-06-15 22:49:48

Jonathan Nieder [off-list ref] writes:
Just to throw an idea out: you can also do something like

#ifndef NO_POSIX_GOODIES
struct credentials {
};
#else
struct credentials {
	struct passwd *pass;
	gid_t gid;
}
#endif

and pass a pointer to credentials around.
Empty structures are not standard C.  But if you only ever use a pointer
to the struct you can leave it undefined (ie. just forward-declare it).

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

empty structs

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:49:48

Andreas Schwab wrote:
Jonathan Nieder [off-list ref] writes:
quoted
Just to throw an idea out: you can also do something like

#ifndef NO_POSIX_GOODIES
struct credentials {
};
#else
[...]
Empty structures are not standard C.
(For those following at home:

	"A structure type describes a sequentially allocated
	 nonempty set of member objects (and, in certain
	 circumstances, an incomplete array), each of which
	 has an optionally specified name and possibly
	 distinct type.")

So I guess future patches following the pattern of v1.7.3-rc0~33^2~13
git wrapper: introduce startup_info struct, 2010-08-05) should be
written like

	struct startup_info {
		char dummy;
	};

Yuck.  Thanks for the pointer.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help