MEDIUM: stick-table: make the use of 'gpt' excluding the use of 'gpt0'

This patch makes the use of 'gpt' excluding the use of the legacy
type 'gpt0' on the same table.

It also makes the 'gpt0' related fetches and actions applying
to the first element of the 'gpt' array if stored in table.
diff --git a/src/stick_table.c b/src/stick_table.c
index 7fcda82..7bf0e52 100644
--- a/src/stick_table.c
+++ b/src/stick_table.c
@@ -949,6 +949,12 @@
 				}
 			}
 			idx++;
+			if (t->data_ofs[STKTABLE_DT_GPT] && t->data_ofs[STKTABLE_DT_GPT0]) {
+				ha_alert("parsing [%s:%d] : %s: simultaneous usage of 'gpt' and 'gpt0' in a same table is not permitted as 'gpt' overrides 'gpt0'.\n",
+					 file, linenum, args[0]);
+				err_code |= ERR_ALERT | ERR_FATAL;
+				goto out;
+			}
 		}
 		else if (strcmp(args[idx], "srvkey") == 0) {
 			char *keytype;
@@ -1475,6 +1481,9 @@
 		return 1;
 
 	ptr = stktable_data_ptr(t, ts, STKTABLE_DT_GPT0);
+	if (!ptr)
+		ptr = stktable_data_ptr_idx(t, ts, STKTABLE_DT_GPT, 0);
+
 	if (ptr)
 		smp->data.u.sint = stktable_data_cast(ptr, std_t_uint);
 
@@ -2319,6 +2328,9 @@
 
 	/* Store the sample in the required sc, and ignore errors. */
 	ptr = stktable_data_ptr(stkctr->table, ts, STKTABLE_DT_GPT0);
+	if (!ptr)
+		ptr = stktable_data_ptr_idx(stkctr->table, ts, STKTABLE_DT_GPT, 0);
+
 	if (ptr) {
 		if (!rule->arg.gpt.expr)
 			value = (unsigned int)(rule->arg.gpt.value);
@@ -2698,6 +2710,9 @@
 		void *ptr;
 
 		ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_GPT0);
+		if (!ptr)
+			ptr = stktable_data_ptr_idx(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_GPT, 0);
+
 		if (!ptr) {
 			if (stkctr == &tmpstkctr)
 				stktable_release(stkctr->table, stkctr_entry(stkctr));