]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: stktable: move sample_conv_table_bytes_out_rate()
authorAurelien DARRAGON <adarragon@haproxy.com>
Wed, 15 Jan 2025 20:14:48 +0000 (21:14 +0100)
committerAurelien DARRAGON <adarragon@haproxy.com>
Thu, 16 Jan 2025 10:50:27 +0000 (11:50 +0100)
sample_conv_table_bytes_out_rate() was defined in the middle of other
stick-table sample convs without any ordering logic. Let's put it
where it belongs, right after sample_conv_table_bytes_in_rate().

src/stick_table.c

index 365c9e0b6b72a0ca1ada84dd73eceb2819e8343c..dd23b52d6ea60c8dd2e15098f65534a63d1a6291 100644 (file)
@@ -1825,6 +1825,23 @@ static int sample_conv_table_bytes_in_rate(const struct arg *arg_p, struct sampl
        return smp_fetch_bytes_in_rate(&stkctr, smp, 1);
 }
 
+/* Casts sample <smp> to the type of the table specified in arg(0), and looks
+ * it up into this table. Returns the data rate sent to clients in bytes/s
+ * if the key is present in the table, otherwise zero, so that comparisons can
+ * be easily performed. If the inspected parameter is not stored in the table,
+ * <not found> is returned.
+ */
+static int smp_fetch_bytes_out_rate(struct stkctr *stkctr, struct sample *smp, int decrefcnt);
+static int sample_conv_table_bytes_out_rate(const struct arg *arg_p, struct sample *smp, void *private)
+{
+       struct stkctr stkctr;
+
+       stkctr.table = arg_p[0].data.t;
+       stkctr_set_entry(&stkctr, smp_fetch_stksess(stkctr.table, smp, 0));
+
+       return smp_fetch_bytes_out_rate(&stkctr, smp, 1);
+}
+
 /* Casts sample <smp> to the type of the table specified in arg(0), and looks
  * it up into this table. Returns the cumulated number of connections for the key
  * if the key is present in the table, otherwise zero, so that comparisons can
@@ -1942,23 +1959,6 @@ static int sample_conv_table_idle(const struct arg *arg_p, struct sample *smp, v
        return 1;
 }
 
-/* Casts sample <smp> to the type of the table specified in arg(0), and looks
- * it up into this table. Returns the data rate sent to clients in bytes/s
- * if the key is present in the table, otherwise zero, so that comparisons can
- * be easily performed. If the inspected parameter is not stored in the table,
- * <not found> is returned.
- */
-static int smp_fetch_bytes_out_rate(struct stkctr *stkctr, struct sample *smp, int decrefcnt);
-static int sample_conv_table_bytes_out_rate(const struct arg *arg_p, struct sample *smp, void *private)
-{
-       struct stkctr stkctr;
-
-       stkctr.table = arg_p[0].data.t;
-       stkctr_set_entry(&stkctr, smp_fetch_stksess(stkctr.table, smp, 0));
-
-       return smp_fetch_bytes_out_rate(&stkctr, smp, 1);
-}
-
 /* Casts sample <smp> to the type of the table specified in arg(0), and looks
  * it up into this table. Returns the cumulated number of front glitches for the
  * key if the key is present in the table, otherwise zero, so that comparisons