MINOR: samples: rename union from "data" to "u"
The union name "data" is a little bit heavy while we read the source
code because we can read "data.data.sint". The rename from "data" to "u"
makes the read easiest like "data.u.sint".
diff --git a/src/stream.c b/src/stream.c
index acb602a..5280e37 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -2672,7 +2672,7 @@
{
smp->flags = SMP_F_VOL_TEST;
smp->data.type = SMP_T_BOOL;
- smp->data.data.sint = !!smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
+ smp->data.u.sint = !!smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
return 1;
}
@@ -2691,13 +2691,13 @@
smp->flags = SMP_F_VOL_TEST;
smp->data.type = SMP_T_SINT;
- smp->data.data.sint = 0;
+ smp->data.u.sint = 0;
if (stkctr_entry(stkctr) != NULL) {
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_GPC0);
if (!ptr)
return 0; /* parameter not stored */
- smp->data.data.sint = stktable_data_cast(ptr, gpc0);
+ smp->data.u.sint = stktable_data_cast(ptr, gpc0);
}
return 1;
}
@@ -2717,12 +2717,12 @@
smp->flags = SMP_F_VOL_TEST;
smp->data.type = SMP_T_SINT;
- smp->data.data.sint = 0;
+ smp->data.u.sint = 0;
if (stkctr_entry(stkctr) != NULL) {
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_GPC0_RATE);
if (!ptr)
return 0; /* parameter not stored */
- smp->data.data.sint = read_freq_ctr_period(&stktable_data_cast(ptr, gpc0_rate),
+ smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, gpc0_rate),
stkctr->table->data_arg[STKTABLE_DT_GPC0_RATE].u);
}
return 1;
@@ -2742,7 +2742,7 @@
smp->flags = SMP_F_VOL_TEST;
smp->data.type = SMP_T_SINT;
- smp->data.data.sint = 0;
+ smp->data.u.sint = 0;
if (stkctr_entry(stkctr) == NULL)
stkctr = smp_create_src_stkctr(smp->sess, smp->strm, args, kw);
@@ -2757,12 +2757,12 @@
if (ptr1) {
update_freq_ctr_period(&stktable_data_cast(ptr1, gpc0_rate),
stkctr->table->data_arg[STKTABLE_DT_GPC0_RATE].u, 1);
- smp->data.data.sint = (&stktable_data_cast(ptr1, gpc0_rate))->curr_ctr;
+ smp->data.u.sint = (&stktable_data_cast(ptr1, gpc0_rate))->curr_ctr;
}
ptr2 = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_GPC0);
if (ptr2)
- smp->data.data.sint = ++stktable_data_cast(ptr2, gpc0);
+ smp->data.u.sint = ++stktable_data_cast(ptr2, gpc0);
/* If data was modified, we need to touch to re-schedule sync */
if (ptr1 || ptr2)
@@ -2785,7 +2785,7 @@
smp->flags = SMP_F_VOL_TEST;
smp->data.type = SMP_T_SINT;
- smp->data.data.sint = 0;
+ smp->data.u.sint = 0;
if (stkctr_entry(stkctr) == NULL)
stkctr = smp_create_src_stkctr(smp->sess, smp->strm, args, kw);
@@ -2794,7 +2794,7 @@
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_GPC0);
if (!ptr)
return 0; /* parameter not stored */
- smp->data.data.sint = stktable_data_cast(ptr, gpc0);
+ smp->data.u.sint = stktable_data_cast(ptr, gpc0);
stktable_data_cast(ptr, gpc0) = 0;
/* If data was modified, we need to touch to re-schedule sync */
stktable_touch(stkctr->table, stkctr_entry(stkctr), 1);
@@ -2816,12 +2816,12 @@
smp->flags = SMP_F_VOL_TEST;
smp->data.type = SMP_T_SINT;
- smp->data.data.sint = 0;
+ smp->data.u.sint = 0;
if (stkctr_entry(stkctr) != NULL) {
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_CONN_CNT);
if (!ptr)
return 0; /* parameter not stored */
- smp->data.data.sint = stktable_data_cast(ptr, conn_cnt);
+ smp->data.u.sint = stktable_data_cast(ptr, conn_cnt);
}
return 1;
}
@@ -2840,12 +2840,12 @@
smp->flags = SMP_F_VOL_TEST;
smp->data.type = SMP_T_SINT;
- smp->data.data.sint = 0;
+ smp->data.u.sint = 0;
if (stkctr_entry(stkctr) != NULL) {
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_CONN_RATE);
if (!ptr)
return 0; /* parameter not stored */
- smp->data.data.sint = read_freq_ctr_period(&stktable_data_cast(ptr, conn_rate),
+ smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, conn_rate),
stkctr->table->data_arg[STKTABLE_DT_CONN_RATE].u);
}
return 1;
@@ -2882,7 +2882,7 @@
return 0; /* parameter not stored in this table */
smp->data.type = SMP_T_SINT;
- smp->data.data.sint = ++stktable_data_cast(ptr, conn_cnt);
+ smp->data.u.sint = ++stktable_data_cast(ptr, conn_cnt);
/* Touch was previously performed by stktable_update_key */
smp->flags = SMP_F_VOL_TEST;
return 1;
@@ -2902,12 +2902,12 @@
smp->flags = SMP_F_VOL_TEST;
smp->data.type = SMP_T_SINT;
- smp->data.data.sint = 0;
+ smp->data.u.sint = 0;
if (stkctr_entry(stkctr) != NULL) {
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_CONN_CUR);
if (!ptr)
return 0; /* parameter not stored */
- smp->data.data.sint = stktable_data_cast(ptr, conn_cur);
+ smp->data.u.sint = stktable_data_cast(ptr, conn_cur);
}
return 1;
}
@@ -2926,12 +2926,12 @@
smp->flags = SMP_F_VOL_TEST;
smp->data.type = SMP_T_SINT;
- smp->data.data.sint = 0;
+ smp->data.u.sint = 0;
if (stkctr_entry(stkctr) != NULL) {
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_SESS_CNT);
if (!ptr)
return 0; /* parameter not stored */
- smp->data.data.sint = stktable_data_cast(ptr, sess_cnt);
+ smp->data.u.sint = stktable_data_cast(ptr, sess_cnt);
}
return 1;
}
@@ -2949,12 +2949,12 @@
smp->flags = SMP_F_VOL_TEST;
smp->data.type = SMP_T_SINT;
- smp->data.data.sint = 0;
+ smp->data.u.sint = 0;
if (stkctr_entry(stkctr) != NULL) {
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_SESS_RATE);
if (!ptr)
return 0; /* parameter not stored */
- smp->data.data.sint = read_freq_ctr_period(&stktable_data_cast(ptr, sess_rate),
+ smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, sess_rate),
stkctr->table->data_arg[STKTABLE_DT_SESS_RATE].u);
}
return 1;
@@ -2974,12 +2974,12 @@
smp->flags = SMP_F_VOL_TEST;
smp->data.type = SMP_T_SINT;
- smp->data.data.sint = 0;
+ smp->data.u.sint = 0;
if (stkctr_entry(stkctr) != NULL) {
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_HTTP_REQ_CNT);
if (!ptr)
return 0; /* parameter not stored */
- smp->data.data.sint = stktable_data_cast(ptr, http_req_cnt);
+ smp->data.u.sint = stktable_data_cast(ptr, http_req_cnt);
}
return 1;
}
@@ -2998,12 +2998,12 @@
smp->flags = SMP_F_VOL_TEST;
smp->data.type = SMP_T_SINT;
- smp->data.data.sint = 0;
+ smp->data.u.sint = 0;
if (stkctr_entry(stkctr) != NULL) {
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_HTTP_REQ_RATE);
if (!ptr)
return 0; /* parameter not stored */
- smp->data.data.sint = read_freq_ctr_period(&stktable_data_cast(ptr, http_req_rate),
+ smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, http_req_rate),
stkctr->table->data_arg[STKTABLE_DT_HTTP_REQ_RATE].u);
}
return 1;
@@ -3023,12 +3023,12 @@
smp->flags = SMP_F_VOL_TEST;
smp->data.type = SMP_T_SINT;
- smp->data.data.sint = 0;
+ smp->data.u.sint = 0;
if (stkctr_entry(stkctr) != NULL) {
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_HTTP_ERR_CNT);
if (!ptr)
return 0; /* parameter not stored */
- smp->data.data.sint = stktable_data_cast(ptr, http_err_cnt);
+ smp->data.u.sint = stktable_data_cast(ptr, http_err_cnt);
}
return 1;
}
@@ -3047,12 +3047,12 @@
smp->flags = SMP_F_VOL_TEST;
smp->data.type = SMP_T_SINT;
- smp->data.data.sint = 0;
+ smp->data.u.sint = 0;
if (stkctr_entry(stkctr) != NULL) {
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_HTTP_ERR_RATE);
if (!ptr)
return 0; /* parameter not stored */
- smp->data.data.sint = read_freq_ctr_period(&stktable_data_cast(ptr, http_err_rate),
+ smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, http_err_rate),
stkctr->table->data_arg[STKTABLE_DT_HTTP_ERR_RATE].u);
}
return 1;
@@ -3072,12 +3072,12 @@
smp->flags = SMP_F_VOL_TEST;
smp->data.type = SMP_T_SINT;
- smp->data.data.sint = 0;
+ smp->data.u.sint = 0;
if (stkctr_entry(stkctr) != NULL) {
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_BYTES_IN_CNT);
if (!ptr)
return 0; /* parameter not stored */
- smp->data.data.sint = stktable_data_cast(ptr, bytes_in_cnt) >> 10;
+ smp->data.u.sint = stktable_data_cast(ptr, bytes_in_cnt) >> 10;
}
return 1;
}
@@ -3096,12 +3096,12 @@
smp->flags = SMP_F_VOL_TEST;
smp->data.type = SMP_T_SINT;
- smp->data.data.sint = 0;
+ smp->data.u.sint = 0;
if (stkctr_entry(stkctr) != NULL) {
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_BYTES_IN_RATE);
if (!ptr)
return 0; /* parameter not stored */
- smp->data.data.sint = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_in_rate),
+ smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_in_rate),
stkctr->table->data_arg[STKTABLE_DT_BYTES_IN_RATE].u);
}
return 1;
@@ -3121,12 +3121,12 @@
smp->flags = SMP_F_VOL_TEST;
smp->data.type = SMP_T_SINT;
- smp->data.data.sint = 0;
+ smp->data.u.sint = 0;
if (stkctr_entry(stkctr) != NULL) {
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_BYTES_OUT_CNT);
if (!ptr)
return 0; /* parameter not stored */
- smp->data.data.sint = stktable_data_cast(ptr, bytes_out_cnt) >> 10;
+ smp->data.u.sint = stktable_data_cast(ptr, bytes_out_cnt) >> 10;
}
return 1;
}
@@ -3145,12 +3145,12 @@
smp->flags = SMP_F_VOL_TEST;
smp->data.type = SMP_T_SINT;
- smp->data.data.sint = 0;
+ smp->data.u.sint = 0;
if (stkctr_entry(stkctr) != NULL) {
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_BYTES_OUT_RATE);
if (!ptr)
return 0; /* parameter not stored */
- smp->data.data.sint = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_out_rate),
+ smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_out_rate),
stkctr->table->data_arg[STKTABLE_DT_BYTES_OUT_RATE].u);
}
return 1;
@@ -3169,7 +3169,7 @@
smp->flags = SMP_F_VOL_TEST;
smp->data.type = SMP_T_SINT;
- smp->data.data.sint = stkctr_entry(stkctr)->ref_cnt;
+ smp->data.u.sint = stkctr_entry(stkctr)->ref_cnt;
return 1;
}
@@ -3181,7 +3181,7 @@
{
smp->flags = SMP_F_VOL_TEST;
smp->data.type = SMP_T_SINT;
- smp->data.data.sint = args->data.prx->table.current;
+ smp->data.u.sint = args->data.prx->table.current;
return 1;
}
@@ -3196,7 +3196,7 @@
px = args->data.prx;
smp->flags = SMP_F_VOL_TEST;
smp->data.type = SMP_T_SINT;
- smp->data.data.sint = px->table.size - px->table.current;
+ smp->data.u.sint = px->table.size - px->table.current;
return 1;
}