mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-18 11:31:00 -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:
7
misc.h
7
misc.h
@ -37,9 +37,14 @@ char *dupprintf(const char *fmt, ...)
|
||||
char *dupvprintf(const char *fmt, va_list ap);
|
||||
void burnstr(char *string);
|
||||
|
||||
struct strbuf {
|
||||
char *s;
|
||||
unsigned char *u;
|
||||
int len;
|
||||
/* (also there's a surrounding implementation struct in misc.c) */
|
||||
};
|
||||
strbuf *strbuf_new(void);
|
||||
void strbuf_free(strbuf *buf);
|
||||
char *strbuf_str(strbuf *buf); /* does not free buf */
|
||||
char *strbuf_to_str(strbuf *buf); /* does free buf, but you must free result */
|
||||
void strbuf_catf(strbuf *buf, const char *fmt, ...);
|
||||
void strbuf_catfv(strbuf *buf, const char *fmt, va_list ap);
|
||||
|
Reference in New Issue
Block a user