MINOR: stick_table: centralize the handling of empty keys
Right now, it's up to each pattern fetch method to return NULL when an empty string is returned, which is neither correct nor desirable as it is only stick tables which need to ignore empty patterns. Let's perform this check in stktable_fetch_key() instead.
This commit is contained in:
parent
82ea800b0f
commit
7fc1c6eefb
|
@ -609,6 +609,9 @@ struct stktable_key *stktable_fetch_key(struct stktable *t, struct proxy *px, st
|
|||
if (!static_table_key.key)
|
||||
return NULL;
|
||||
|
||||
if (static_table_key.key_len == 0)
|
||||
return NULL;
|
||||
|
||||
if ((static_table_key.key_len < t->key_size) && (t->type != STKTABLE_TYPE_STRING)) {
|
||||
/* need padding with null */
|
||||
|
||||
|
@ -635,7 +638,6 @@ struct stktable_key *stktable_fetch_key(struct stktable *t, struct proxy *px, st
|
|||
memset(static_table_key.key + static_table_key.key_len, 0, t->key_size - static_table_key.key_len);
|
||||
}
|
||||
|
||||
|
||||
return &static_table_key;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue