MINOR: sample: export 'sample_get_trash_chunk(void)'
This will be used on external fetch modules.
diff --git a/include/proto/sample.h b/include/proto/sample.h
index 471eb5f..47099b3 100644
--- a/include/proto/sample.h
+++ b/include/proto/sample.h
@@ -32,5 +32,6 @@
struct sample *p);
void sample_register_fetches(struct sample_fetch_kw_list *psl);
void sample_register_convs(struct sample_conv_kw_list *psl);
+struct chunk *sample_get_trash_chunk(void);
#endif /* _PROTO_SAMPLE_H */
diff --git a/src/sample.c b/src/sample.c
index b9e3c18..296dea2 100644
--- a/src/sample.c
+++ b/src/sample.c
@@ -107,7 +107,7 @@
* Returns a static trash struct chunk to use in sample casts or format conversions
* Swiths the 2 available trash buffers to protect data during convert
*/
-static struct chunk *get_trash_chunk(void)
+struct chunk *sample_get_trash_chunk(void)
{
if (sample_trash_buf == sample_trash_buf1)
sample_trash_buf = sample_trash_buf2;
@@ -133,7 +133,7 @@
static int c_ip2str(struct sample *smp)
{
- struct chunk *trash = get_trash_chunk();
+ struct chunk *trash = sample_get_trash_chunk();
if (!inet_ntop(AF_INET, (void *)&smp->data.ipv4, trash->str, trash->size))
return 0;
@@ -152,7 +152,7 @@
static int c_ipv62str(struct sample *smp)
{
- struct chunk *trash = get_trash_chunk();
+ struct chunk *trash = sample_get_trash_chunk();
if (!inet_ntop(AF_INET6, (void *)&smp->data.ipv6, trash->str, trash->size))
return 0;
@@ -189,7 +189,7 @@
static int c_bin2str(struct sample *smp)
{
- struct chunk *trash = get_trash_chunk();
+ struct chunk *trash = sample_get_trash_chunk();
unsigned char c;
int ptr = 0;
@@ -205,7 +205,7 @@
static int c_int2str(struct sample *smp)
{
- struct chunk *trash = get_trash_chunk();
+ struct chunk *trash = sample_get_trash_chunk();
char *pos;
pos = ultoa_r(smp->data.uint, trash->str, trash->size);
@@ -222,7 +222,7 @@
static int c_datadup(struct sample *smp)
{
- struct chunk *trash = get_trash_chunk();
+ struct chunk *trash = sample_get_trash_chunk();
trash->len = smp->data.str.len < trash->size ? smp->data.str.len : trash->size;
memcpy(trash->str, smp->data.str.str, trash->len);