Branch: Tag:

2016-12-31

2016-12-31 17:12:23 by Arne Goedeke <el@laramies.com>

Replace dynamic_buffer API everywhere

This change should be purely cosmetic. It replaces the old
dynamic_buffer API by the corresponding byte_buffer API everywhere.
The wrapper definitions in dynamic_buffer.h will remain for now.

15:   #include "array.h"   #include "multiset.h"   #include "lex.h" - #include "dynamic_buffer.h" + #include "buffer.h"   #include "pike_error.h"   #include "operators.h"   #include "builtin_functions.h"
160:    * value less than COUNTER_START means that it's a forward reference    * to a thing not yet encoded. */    struct array *delayed; -  dynamic_buffer buf; +  struct byte_buffer buf;   #ifdef ENCODE_DEBUG    int debug, depth;   #endif
179:      static void encode_value2(struct svalue *val, struct encode_data *data, int force_encode);    - #define addstr(s, l) low_my_binary_strcat((s), (l), &(data->buf)) - #define addchar(t) low_my_putchar((char)(t), &(data->buf)) + #define addstr(s, l) buffer_memcpy(&(data->buf), (s), (l)) + #define addchar(t) buffer_add_char(&(data->buf), (char)(t))   #define addchar_unsafe(t) buffer_add_char_unsafe(&(data->buf), t)      /* Code a pike string */
1692:      static void free_encode_data(struct encode_data *data)   { -  toss_buffer(& data->buf); +  buffer_free(& data->buf);    if (data->codec) free_object (data->codec);    free_mapping(data->encoded);    free_array(data->delayed);
1754:   #endif    0);    -  initialize_buf(&data->buf); +  buffer_init(&data->buf);    data->canonic = 0;    data->encoded=allocate_mapping(128);    data->encoded->data->flags |= MAPPING_FLAG_NO_SHRINK;
1792:    free_array (data->delayed);       pop_n_elems(args); -  push_string(low_free_buf(&data->buf)); +  push_string(buffer_finish_pike_string(&data->buf));   }      /*! @decl string encode_value_canonic(mixed value, object|void codec)
1832:   #endif    0);    -  initialize_buf(&data->buf); +  buffer_init(&data->buf);    data->canonic = 1;    data->encoded=allocate_mapping(128);    data->delayed = allocate_array (0);
1869:    free_array (data->delayed);       pop_n_elems(args); -  push_string(low_free_buf(&data->buf)); +  push_string(buffer_finish_pike_string(&data->buf));   }