mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-18 13:05:38 +00:00
MINOR: buffer: remove buffer_slow_realign() and the swap_buffer allocation code
Since all call places can use the trash now, this is not needed anymore.
This commit is contained in:
parent
0db4d10efc
commit
c0a51c51b1
@ -52,7 +52,6 @@ void deinit_buffer();
|
||||
int buffer_replace2(struct buffer *b, char *pos, char *end, const char *str, int len);
|
||||
int buffer_insert_line2(struct buffer *b, char *pos, const char *str, int len);
|
||||
void buffer_dump(FILE *o, struct buffer *b, int from, int to);
|
||||
void buffer_slow_realign(struct buffer *buf, size_t output);
|
||||
|
||||
/*****************************************************************/
|
||||
/* These functions are used to compute various buffer area sizes */
|
||||
|
36
src/buffer.c
36
src/buffer.c
@ -35,24 +35,6 @@ struct buffer buf_wanted = { .p = buf_wanted.data };
|
||||
struct list buffer_wq = LIST_HEAD_INIT(buffer_wq);
|
||||
__decl_hathreads(HA_SPINLOCK_T __attribute__((aligned(64))) buffer_wq_lock);
|
||||
|
||||
/* this buffer is always the same size as standard buffers and is used for
|
||||
* swapping data inside a buffer.
|
||||
*/
|
||||
static THREAD_LOCAL char *swap_buffer = NULL;
|
||||
|
||||
static int init_buffer_per_thread()
|
||||
{
|
||||
swap_buffer = calloc(1, global.tune.bufsize);
|
||||
if (swap_buffer == NULL)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void deinit_buffer_per_thread()
|
||||
{
|
||||
free(swap_buffer); swap_buffer = NULL;
|
||||
}
|
||||
|
||||
/* perform minimal intializations, report 0 in case of error, 1 if OK. */
|
||||
int init_buffer()
|
||||
{
|
||||
@ -80,9 +62,6 @@ int init_buffer()
|
||||
return 0;
|
||||
|
||||
pool_free(pool_head_buffer, buffer);
|
||||
|
||||
hap_register_per_thread_init(init_buffer_per_thread);
|
||||
hap_register_per_thread_deinit(deinit_buffer_per_thread);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -168,21 +147,6 @@ int buffer_insert_line2(struct buffer *b, char *pos, const char *str, int len)
|
||||
return delta;
|
||||
}
|
||||
|
||||
/* This function realigns a possibly wrapping buffer so that the input part is
|
||||
* contiguous and starts at the beginning of the buffer and the output part
|
||||
* ends at the end of the buffer. This provides the best conditions since it
|
||||
* allows the largest inputs to be processed at once and ensures that once the
|
||||
* output data leaves, the whole buffer is available at once. The number of
|
||||
* output bytes supposedly present at the beginning of the buffer and which
|
||||
* need to be moved to the end must be passed in <output>. It's up to the
|
||||
* caller to ensure <output> is no larger than the difference between the
|
||||
* while buffer's length and its input.
|
||||
*/
|
||||
void buffer_slow_realign(struct buffer *buf, size_t output)
|
||||
{
|
||||
return b_slow_realign(buf, swap_buffer, output);
|
||||
}
|
||||
|
||||
/*
|
||||
* Dumps part or all of a buffer.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user