mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 03:22:48 -05:00
New header file 'defs.h'.
This centralises a few things that multiple header files were previously defining, and were protecting against each other's redefinition with ifdefs - small things like structs and typedefs. Now all those things are in a defs.h which is by definition safe to include _first_ (out of all the codebase-local headers) and only need to be defined once.
This commit is contained in:
37
defs.h
Normal file
37
defs.h
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* defs.h: initial definitions for PuTTY.
|
||||
*
|
||||
* The rule about this header file is that it can't depend on any
|
||||
* other header file in this code base. This is where we define
|
||||
* things, as much as we can, that other headers will want to refer
|
||||
* to, such as opaque structure types and their associated typedefs,
|
||||
* or macros that are used by other headers.
|
||||
*/
|
||||
|
||||
#ifndef PUTTY_DEFS_H
|
||||
#define PUTTY_DEFS_H
|
||||
|
||||
typedef struct conf_tag Conf;
|
||||
typedef struct backend_tag Backend;
|
||||
typedef struct terminal_tag Terminal;
|
||||
|
||||
typedef struct Filename Filename;
|
||||
typedef struct FontSpec FontSpec;
|
||||
|
||||
typedef struct bufchain_tag bufchain;
|
||||
|
||||
typedef struct strbuf strbuf;
|
||||
|
||||
struct RSAKey;
|
||||
|
||||
#include <stdint.h>
|
||||
typedef uint32_t uint32;
|
||||
|
||||
/* Do a compile-time type-check of 'to_check' (without evaluating it),
|
||||
* as a side effect of returning the value 'to_return'. Note that
|
||||
* although this macro double-*expands* to_return, it always
|
||||
* *evaluates* exactly one copy of it, so it's side-effect safe. */
|
||||
#define TYPECHECK(to_check, to_return) \
|
||||
(sizeof(to_check) ? (to_return) : (to_return))
|
||||
|
||||
#endif /* PUTTY_DEFS_H */
|
Reference in New Issue
Block a user