cb22561995-10-11Fredrik Hübinette (Hubbe) /*\
3e9a462002-01-16Martin Nilsson ||| This file is part of Pike. For copyright information see COPYRIGHT.
59e32d2002-06-01Martin Nilsson ||| Pike is distributed under GPL, LGPL and MPL. See the file COPYING ||| for more information.
cb22561995-10-11Fredrik Hübinette (Hubbe) \*/
24ddc71998-03-28Henrik Grubbström (Grubba)  /*
59e32d2002-06-01Martin Nilsson  * $Id: dynamic_buffer.h,v 1.13 2002/05/31 22:41:23 nilsson Exp $
24ddc71998-03-28Henrik Grubbström (Grubba)  */
5267b71995-08-09Fredrik Hübinette (Hubbe) #ifndef DYNAMIC_BUFFER_H #define DYNAMIC_BUFFER_H #define BUFFER_BEGIN_SIZE 4080 struct string_s { char *str; SIZE_T len; }; typedef struct string_s string; struct dynamic_buffer_s { string s; SIZE_T bufsize; }; typedef struct dynamic_buffer_s dynamic_buffer; /* Prototypes begin here */
f31ced2000-12-16Marcus Comstedt PMOD_EXPORT char *low_make_buf_space(size_t space, dynamic_buffer *buf); PMOD_EXPORT void low_my_putchar(char b,dynamic_buffer *buf); PMOD_EXPORT void low_my_binary_strcat(const char *b, size_t l, dynamic_buffer *buf); PMOD_EXPORT void debug_initialize_buf(dynamic_buffer *buf); PMOD_EXPORT void low_reinit_buf(dynamic_buffer *buf); PMOD_EXPORT void low_init_buf_with_string(string s, dynamic_buffer *buf); PMOD_EXPORT string complex_free_buf(void); PMOD_EXPORT void toss_buffer(dynamic_buffer *buf); PMOD_EXPORT char *simple_free_buf(void); PMOD_EXPORT struct pike_string *debug_low_free_buf(dynamic_buffer *buf); PMOD_EXPORT struct pike_string *debug_free_buf(void); PMOD_EXPORT char *make_buf_space(INT32 space); PMOD_EXPORT void my_putchar(char b); PMOD_EXPORT void my_binary_strcat(const char *b, ptrdiff_t l); PMOD_EXPORT void my_strcat(const char *b); PMOD_EXPORT void init_buf(void); PMOD_EXPORT void init_buf_with_string(string s); PMOD_EXPORT char *debug_return_buf(void);
5267b71995-08-09Fredrik Hübinette (Hubbe) /* Prototypes end here */
61e9a01998-01-25Fredrik Hübinette (Hubbe) #ifdef DEBUG_MALLOC #define initialize_buf(X) \ do { dynamic_buffer *b_=(X); debug_initialize_buf(b_); \
20f7a02000-03-20Fredrik Hübinette (Hubbe)  debug_malloc_touch(b_->s.str); } while(0)
3c0c281998-01-26Fredrik Hübinette (Hubbe) #define low_free_buf(X) \
fe6bb62000-03-26Henrik Grubbström (Grubba)  ((struct pike_string *)debug_malloc_pass(debug_low_free_buf(X)))
3c0c281998-01-26Fredrik Hübinette (Hubbe)  #define free_buf() \
fe6bb62000-03-26Henrik Grubbström (Grubba)  ((struct pike_string *)debug_malloc_pass(debug_free_buf()))
3c0c281998-01-26Fredrik Hübinette (Hubbe)  #define return_buf() \
fe6bb62000-03-26Henrik Grubbström (Grubba)  ((char *)debug_malloc_pass(debug_return_buf()))
3c0c281998-01-26Fredrik Hübinette (Hubbe) 
61e9a01998-01-25Fredrik Hübinette (Hubbe) #else #define initialize_buf debug_initialize_buf
3c0c281998-01-26Fredrik Hübinette (Hubbe) #define low_free_buf debug_low_free_buf #define free_buf debug_free_buf #define return_buf debug_return_buf
61e9a01998-01-25Fredrik Hübinette (Hubbe) #endif
5267b71995-08-09Fredrik Hübinette (Hubbe) #endif