[coreboot] [PATCHES]: coreboot-v2 on win32 / mingw

Peter Stuge peter at stuge.se
Sat Nov 21 20:21:09 CET 2009


Patrick Georgi wrote:
> +#ifndef WIN32
> +#include <arpa/inet.h>
> +#else
> +#define ntohl(x) ((x>>24) | (x<<24) | ((x>>8)&0xff00) | ((x<<8)&0xff0000))

It's common to guard x in each use with () I guess in order to avoid
ordering issues if x isn't a simple number.


> +#ifdef WIN32
> +#define mkdir(x,y) mkdir(x)
> +#define UNLINK(x) unlink(x)
> +#else
> +#define UNLINK(X) 
> +#endif

Maybe name UNLINK() something else to show that it's not always being
done?


> +	awk '/^#define ([^"])* ([^"])*$$/ {gsub("\\r","",$$3); print $$2 " = " $$3 ";";}' $< > $@

This assumes that the macro expansion will never contain whitespace -
is that true? If not, I suggest:

awk '/^#define ([^"])* ([^"])*$$/ {gsub("\\r","",$$NF); exp=$$0; sub("^#define [^\"]* ","",exp); print $$2 " = " exp ";";}' $< > $@


Other than that:

Acked-by: Peter Stuge <peter at stuge.se>




More information about the coreboot mailing list