1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-02 03:52:49 -05:00

Make strbuf a less opaque type.

Now, instead of being a black box that you shovel strings into and
eventually extract a final answer, it exposes enough structure fields
to the world that you can append things to it _and_ look inside its
current contents. For convenience, it exports its internal pointer as
both a char * and an unsigned char *.
This commit is contained in:
Simon Tatham
2018-05-24 14:55:10 +01:00
parent 12b38ad9e1
commit bff128fea9
3 changed files with 55 additions and 22 deletions

6
defs.h
View File

@ -34,4 +34,10 @@ typedef uint32_t uint32;
#define TYPECHECK(to_check, to_return) \
(sizeof(to_check) ? (to_return) : (to_return))
/* Return a pointer to the object of structure type 'type' whose field
* with name 'field' is pointed at by 'object'. */
#define FROMFIELD(object, type, field) \
TYPECHECK(object == &((type *)0)->field, \
((type *)(((char *)(object)) - offsetof(type, field))))
#endif /* PUTTY_DEFS_H */