On Tue, Sep 26, 2017 at 1:05 PM, Mihail Abakumov <mikhail.abaku...@ispras.ru> wrote: > Defined useful sized data buffer. It contains pointer to data and size of > this data. Also, defined some macroses for init and free.
"macros" instead of "macroses", same in patch 31. > Signed-off-by: Mihail Abakumov <mikhail.abaku...@ispras.ru> > Signed-off-by: Pavel Dovgalyuk <dovga...@ispras.ru> > Signed-off-by: Dmitriy Koltunov <koltu...@ispras.ru> > --- > include/exec/windbgstub-utils.h | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/include/exec/windbgstub-utils.h b/include/exec/windbgstub-utils.h > index cf2996d8cb..791721d472 100755 > --- a/include/exec/windbgstub-utils.h > +++ b/include/exec/windbgstub-utils.h > @@ -86,6 +86,21 @@ typedef struct PacketData { > uint16_t extra_size; > } PacketData; > > +typedef struct SizedBuf { > + uint8_t *data; > + size_t size; > +} SizedBuf; > + > +#define SBUF_INIT(buf, mem_ptr, len) do { \ > + buf.data = mem_ptr; \ > + buf.size = len; \ > +} while (false) > +#define SBUF_MALLOC(buf, size) SBUF_INIT(buf, g_malloc0(size), size) > +#define SBUF_FREE(buf) do { \ > + g_free(buf.data); \ > + buf.data = NULL; \ > + buf.size = 0; \ > +} while (false) > bool windbg_on_load(void); > void windbg_on_exit(void); > >