1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Centralise TRUE and FALSE definitions into defs.h.

This removes a lot of pointless duplications of those constants.

Of course, _ideally_, I should upgrade to C99 bool throughout the code
base, replacing TRUE and FALSE with true and false and tagging
variables explicitly as bool when that's what they semantically are.
But that's a much bigger piece of work, and shouldn't block this
trivial cleanup!
This commit is contained in:
Simon Tatham 2018-05-26 07:19:18 +01:00
parent 43ec3397b6
commit c9bad331e6
9 changed files with 16 additions and 54 deletions

7
defs.h
View File

@ -11,6 +11,13 @@
#ifndef PUTTY_DEFS_H
#define PUTTY_DEFS_H
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
typedef struct conf_tag Conf;
typedef struct backend_tag Backend;
typedef struct terminal_tag Terminal;

7
misc.h
View File

@ -13,13 +13,6 @@
#include <stdarg.h> /* for va_list */
#include <time.h> /* for struct tm */
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
unsigned long parse_blocksize(const char *bs);
char ctrlparse(char *s, char **next);

View File

@ -8,13 +8,6 @@
#include "putty.h"
#include "ssh.h"
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
struct PortForwarding {
const struct plug_function_table *fn;
/* the above variable absolutely *must* be the first in this structure */

7
raw.c
View File

@ -8,13 +8,6 @@
#include "putty.h"
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#define RAW_MAX_BACKLOG 4096
typedef struct raw_backend_data {

View File

@ -9,13 +9,6 @@
#include "putty.h"
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#define RLOGIN_MAX_BACKLOG 4096
typedef struct rlogin_tag {

7
ssh.c
View File

@ -25,13 +25,6 @@
#define GSS_CTXT_MAYFAIL (1<<3) /* Context may expire during handshake */
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
/*
* Packet type contexts, so that ssh2_pkt_type can correctly decode
* the ambiguous type numbers back into the correct type strings.

View File

@ -41,6 +41,8 @@
#include <string.h>
#include <assert.h>
#include "defs.h"
#ifdef ZLIB_STANDALONE
/*
@ -57,13 +59,15 @@
#define sresize(x, n, type) ( (type *) realloc((x), (n) * sizeof(type)) )
#define sfree(x) ( free((x)) )
#else
#include "ssh.h"
#endif
#ifndef FALSE
#define FALSE 0
#define TRUE (!FALSE)
#endif
#ifndef TRUE
#define TRUE 1
#endif
#else
#include "ssh.h"
#endif
/* ----------------------------------------------------------------------

View File

@ -8,13 +8,6 @@
#include "putty.h"
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#define IAC 255 /* interpret as command: */
#define DONT 254 /* you are not to use option */
#define DO 253 /* please, you use option */

View File

@ -29,13 +29,6 @@
#include <utmpx.h>
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
/* updwtmpx() needs the name of the wtmp file. Try to find it. */
#ifndef WTMPX_FILE
#ifdef _PATH_WTMPX