mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 23:56:57 +02:00
MINOR: samples: rename a struct from sample_storage to sample_data
This a first step of sample reorganization.
This commit is contained in:
parent
cc79b003cb
commit
12ba0c29d6
@ -25,10 +25,10 @@
|
|||||||
#include <types/map.h>
|
#include <types/map.h>
|
||||||
|
|
||||||
/* maps output sample parser */
|
/* maps output sample parser */
|
||||||
int map_parse_ip(const char *text, struct sample_storage *smp);
|
int map_parse_ip(const char *text, struct sample_data *smp);
|
||||||
int map_parse_ip6(const char *text, struct sample_storage *smp);
|
int map_parse_ip6(const char *text, struct sample_data *smp);
|
||||||
int map_parse_str(const char *text, struct sample_storage *smp);
|
int map_parse_str(const char *text, struct sample_data *smp);
|
||||||
int map_parse_int(const char *text, struct sample_storage *smp);
|
int map_parse_int(const char *text, struct sample_data *smp);
|
||||||
|
|
||||||
struct map_reference *map_get_reference(const char *reference);
|
struct map_reference *map_get_reference(const char *reference);
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ void pattern_init_expr(struct pattern_expr *expr);
|
|||||||
struct pattern_expr *pattern_lookup_expr(struct pattern_head *head, struct pat_ref *ref);
|
struct pattern_expr *pattern_lookup_expr(struct pattern_head *head, struct pat_ref *ref);
|
||||||
struct pattern_expr *pattern_new_expr(struct pattern_head *head, struct pat_ref *ref,
|
struct pattern_expr *pattern_new_expr(struct pattern_head *head, struct pat_ref *ref,
|
||||||
char **err, int *reuse);
|
char **err, int *reuse);
|
||||||
struct sample_storage **pattern_find_smp(struct pattern_expr *expr, struct pat_ref_elt *elt);
|
struct sample_data **pattern_find_smp(struct pattern_expr *expr, struct pat_ref_elt *elt);
|
||||||
int pattern_delete(struct pattern_expr *expr, struct pat_ref_elt *ref);
|
int pattern_delete(struct pattern_expr *expr, struct pat_ref_elt *ref);
|
||||||
|
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ struct pat_time {
|
|||||||
* "sample" with a tree entry. It is used with maps.
|
* "sample" with a tree entry. It is used with maps.
|
||||||
*/
|
*/
|
||||||
struct pattern_tree {
|
struct pattern_tree {
|
||||||
struct sample_storage *smp;
|
struct sample_data *smp;
|
||||||
struct pat_ref_elt *ref;
|
struct pat_ref_elt *ref;
|
||||||
struct ebmb_node node;
|
struct ebmb_node node;
|
||||||
};
|
};
|
||||||
@ -168,7 +168,7 @@ struct pattern {
|
|||||||
} ptr; /* indirect values, allocated */
|
} ptr; /* indirect values, allocated */
|
||||||
int len; /* data length when required */
|
int len; /* data length when required */
|
||||||
int sflags; /* flags relative to the storage method. */
|
int sflags; /* flags relative to the storage method. */
|
||||||
struct sample_storage *smp; /* used to store a pointer to sample value associated
|
struct sample_data *smp; /* used to store a pointer to sample value associated
|
||||||
with the match. It is used with maps */
|
with the match. It is used with maps */
|
||||||
struct pat_ref_elt *ref;
|
struct pat_ref_elt *ref;
|
||||||
};
|
};
|
||||||
@ -212,7 +212,7 @@ struct pattern_expr_list {
|
|||||||
/* This struct contain a list of pattern expr */
|
/* This struct contain a list of pattern expr */
|
||||||
struct pattern_head {
|
struct pattern_head {
|
||||||
int (*parse)(const char *text, struct pattern *pattern, int flags, char **err);
|
int (*parse)(const char *text, struct pattern *pattern, int flags, char **err);
|
||||||
int (*parse_smp)(const char *text, struct sample_storage *smp);
|
int (*parse_smp)(const char *text, struct sample_data *smp);
|
||||||
int (*index)(struct pattern_expr *, struct pattern *, char **);
|
int (*index)(struct pattern_expr *, struct pattern *, char **);
|
||||||
void (*delete)(struct pattern_expr *, struct pat_ref_elt *);
|
void (*delete)(struct pattern_expr *, struct pat_ref_elt *);
|
||||||
void (*prune)(struct pattern_expr *);
|
void (*prune)(struct pattern_expr *);
|
||||||
|
@ -269,7 +269,7 @@ struct sample {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Used to store sample constant */
|
/* Used to store sample constant */
|
||||||
struct sample_storage {
|
struct sample_data {
|
||||||
int type; /* SMP_T_* */
|
int type; /* SMP_T_* */
|
||||||
union {
|
union {
|
||||||
long long int sint; /* used for signed 64bits integers */
|
long long int sint; /* used for signed 64bits integers */
|
||||||
|
@ -27,7 +27,7 @@ struct var_desc {
|
|||||||
struct var {
|
struct var {
|
||||||
struct list l; /* Used for chaining vars. */
|
struct list l; /* Used for chaining vars. */
|
||||||
const char *name; /* Contains the variable name. */
|
const char *name; /* Contains the variable name. */
|
||||||
struct sample_storage data; /* data storage. */
|
struct sample_data data; /* data storage. */
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
/* Parse an IPv4 address and store it into the sample.
|
/* Parse an IPv4 address and store it into the sample.
|
||||||
* The output type is IPV4.
|
* The output type is IPV4.
|
||||||
*/
|
*/
|
||||||
int map_parse_ip(const char *text, struct sample_storage *smp)
|
int map_parse_ip(const char *text, struct sample_data *smp)
|
||||||
{
|
{
|
||||||
if (!buf2ip(text, strlen(text), &smp->data.ipv4))
|
if (!buf2ip(text, strlen(text), &smp->data.ipv4))
|
||||||
return 0;
|
return 0;
|
||||||
@ -38,7 +38,7 @@ int map_parse_ip(const char *text, struct sample_storage *smp)
|
|||||||
/* Parse an IPv6 address and store it into the sample.
|
/* Parse an IPv6 address and store it into the sample.
|
||||||
* The output type is IPV6.
|
* The output type is IPV6.
|
||||||
*/
|
*/
|
||||||
int map_parse_ip6(const char *text, struct sample_storage *smp)
|
int map_parse_ip6(const char *text, struct sample_data *smp)
|
||||||
{
|
{
|
||||||
if (!buf2ip6(text, strlen(text), &smp->data.ipv6))
|
if (!buf2ip6(text, strlen(text), &smp->data.ipv6))
|
||||||
return 0;
|
return 0;
|
||||||
@ -52,7 +52,7 @@ int map_parse_ip6(const char *text, struct sample_storage *smp)
|
|||||||
* overwritten because sample_conv_map() makes a const sample with this
|
* overwritten because sample_conv_map() makes a const sample with this
|
||||||
* output.
|
* output.
|
||||||
*/
|
*/
|
||||||
int map_parse_str(const char *text, struct sample_storage *smp)
|
int map_parse_str(const char *text, struct sample_data *smp)
|
||||||
{
|
{
|
||||||
smp->data.str.str = (char *)text;
|
smp->data.str.str = (char *)text;
|
||||||
smp->data.str.len = strlen(text);
|
smp->data.str.len = strlen(text);
|
||||||
@ -65,7 +65,7 @@ int map_parse_str(const char *text, struct sample_storage *smp)
|
|||||||
* number is negative, or UINT if it is positive or null. The function returns
|
* number is negative, or UINT if it is positive or null. The function returns
|
||||||
* zero (error) if the number is too large.
|
* zero (error) if the number is too large.
|
||||||
*/
|
*/
|
||||||
int map_parse_int(const char *text, struct sample_storage *smp)
|
int map_parse_int(const char *text, struct sample_data *smp)
|
||||||
{
|
{
|
||||||
smp->type = SMP_T_SINT;
|
smp->type = SMP_T_SINT;
|
||||||
smp->data.sint = read_int64(&text, text + strlen(text));
|
smp->data.sint = read_int64(&text, text + strlen(text));
|
||||||
|
@ -1606,9 +1606,9 @@ static inline int pat_ref_set_elt(struct pat_ref *ref, struct pat_ref_elt *elt,
|
|||||||
const char *value, char **err)
|
const char *value, char **err)
|
||||||
{
|
{
|
||||||
struct pattern_expr *expr;
|
struct pattern_expr *expr;
|
||||||
struct sample_storage **smp;
|
struct sample_data **smp;
|
||||||
char *sample;
|
char *sample;
|
||||||
struct sample_storage test;
|
struct sample_data test;
|
||||||
|
|
||||||
/* Try all needed converters. */
|
/* Try all needed converters. */
|
||||||
list_for_each_entry(expr, &ref->pat, list) {
|
list_for_each_entry(expr, &ref->pat, list) {
|
||||||
@ -1823,7 +1823,7 @@ static inline
|
|||||||
int pat_ref_push(struct pat_ref_elt *elt, struct pattern_expr *expr,
|
int pat_ref_push(struct pat_ref_elt *elt, struct pattern_expr *expr,
|
||||||
int patflags, char **err)
|
int patflags, char **err)
|
||||||
{
|
{
|
||||||
struct sample_storage *smp;
|
struct sample_data *smp;
|
||||||
struct pattern pattern;
|
struct pattern pattern;
|
||||||
|
|
||||||
/* Create sample */
|
/* Create sample */
|
||||||
@ -2376,7 +2376,7 @@ void pattern_prune(struct pattern_head *head)
|
|||||||
* the function returns NULL. If the key cannot be parsed, the function
|
* the function returns NULL. If the key cannot be parsed, the function
|
||||||
* fill <err>.
|
* fill <err>.
|
||||||
*/
|
*/
|
||||||
struct sample_storage **pattern_find_smp(struct pattern_expr *expr, struct pat_ref_elt *ref)
|
struct sample_data **pattern_find_smp(struct pattern_expr *expr, struct pat_ref_elt *ref)
|
||||||
{
|
{
|
||||||
struct ebmb_node *node;
|
struct ebmb_node *node;
|
||||||
struct pattern_tree *elt;
|
struct pattern_tree *elt;
|
||||||
|
Loading…
Reference in New Issue
Block a user