On Wed, May 29, 2013 at 08:16:25AM -0700, Mihail Costea wrote:
/**
- batadv_dat_entry_hash_find - look for a given dat_entry in the local hash
@@ -393,6 +403,11 @@ static void batadv_dat_entry_add(struct batadv_priv *bat_priv, void *data, case BATADV_DAT_IPV4: choose = batadv_hash_dat_ipv4; break; +#if IS_ENABLED(CONFIG_IPV6)
case BATADV_DAT_IPV6:
choose = batadv_hash_dat_ipv6;
break;
+#endif
mh...I was just wondering: for the hash functions it would be nice to re-use the same "array approach" that you used for the printing format.
So we would have an array of function pointers to reference rather than having this switch block...What do you think?
I think it would be possible to do this for many other "variable" parameters if required.
Should there be a struct that contains all of them, like:
struct batadv_dat_data {
I was thinking of having many array, but I have to say that the "struct idea" is much cleaner and it can be seen like an API. Then we would only have one array of objects of this type.
Cheers,