pike.git / src / dynamic_buffer.h

version» Context lines:

pike.git/src/dynamic_buffer.h:38:   MACRO void low_reinit_buf(dynamic_buffer *buf) {    buffer_clear(buf);   }   MACRO void toss_buffer(dynamic_buffer *buf) {    buffer_free(buf);   }   MACRO struct pike_string *low_free_buf(dynamic_buffer *buf) {    return buffer_finish_pike_string(buf);   }    - /* GLOBAL BUFFER LOGIC */ -  - PMOD_EXPORT extern dynamic_buffer pike_global_buffer; -  - MACRO dynbuf_string complex_free_buf(dynamic_buffer *old_buf) { -  dynbuf_string tmp; -  if(!buffer_ptr(&pike_global_buffer)) return pike_global_buffer; -  tmp=pike_global_buffer; -  buffer_add_char(&tmp, 0); -  buffer_remove(&tmp, 1); -  pike_global_buffer = *old_buf; -  return tmp; - } - MACRO char *simple_free_buf(dynamic_buffer *old_buf) { -  dynbuf_string tmp; -  if(!buffer_ptr(&pike_global_buffer)) return 0; -  tmp = complex_free_buf(old_buf); -  buffer_add_char(&tmp, 0); -  return buffer_ptr(&tmp); - } - MACRO struct pike_string *free_buf(dynamic_buffer *old_buf) { -  struct pike_string *res = low_free_buf(&pike_global_buffer); -  pike_global_buffer = *old_buf; -  return res; - } -  - MACRO void abandon_buf(dynamic_buffer *old_buf) { -  toss_buffer(&pike_global_buffer); -  pike_global_buffer = *old_buf; - } -  - MACRO char *make_buf_space(INT32 space) { -  return low_make_buf_space(space,&pike_global_buffer); - } -  - MACRO void my_putchar(int b) { -  low_my_putchar(b,&pike_global_buffer); - } -  - MACRO void my_binary_strcat(const char *b, ptrdiff_t l) { -  low_my_binary_strcat(b,l,&pike_global_buffer); - } - MACRO void my_strcat(const char *b) { -  my_binary_strcat(b,strlen(b)); - } - MACRO void init_buf(dynamic_buffer *old_buf) { -  *old_buf = pike_global_buffer; -  initialize_buf(&pike_global_buffer); - } - MACRO void save_buffer (dynamic_buffer *save_buf) { -  *save_buf = pike_global_buffer; -  initialize_buf(&pike_global_buffer); - } - MACRO void restore_buffer (const dynamic_buffer *save_buf) { - #ifdef PIKE_DEBUG -  if (buffer_content_length(&pike_global_buffer)) -  Pike_fatal ("Global buffer already in use.\n"); +    #endif -  pike_global_buffer = *save_buf; - } -  - #endif +