]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: sample: export 'sample_get_trash_chunk(void)'
authorEmeric Brun <ebrun@exceliance.fr>
Wed, 17 Oct 2012 13:34:03 +0000 (15:34 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 22 Oct 2012 16:54:24 +0000 (18:54 +0200)
This will be used on external fetch modules.

include/proto/sample.h
src/sample.c

index 471eb5f2a7b93de0db0023d26c84fcd682105416..47099b3d4e7e57e00467d49aaa3b5cec88c9afff 100644 (file)
@@ -32,5 +32,6 @@ struct sample *sample_process(struct proxy *px, struct session *l4,
                                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 */
index b9e3c18b43fede32c18a8532c8e894c6e970a379..296dea22f376631bb58e84cea7be2464dac70c37 100644 (file)
@@ -107,7 +107,7 @@ struct sample_conv *find_sample_conv(const char *kw, int len)
 * 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_ip2int(struct sample *smp)
 
 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_ip2ipv6(struct sample *smp)
 
 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_str2ipv6(struct sample *smp)
 
 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_bin2str(struct sample *smp)
 
 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_int2str(struct sample *smp)
 
 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);