On (22/09/16 10:00), Lukas Slebodnik wrote:
>On (16/09/16 16:19), Petr Cech wrote:
>>On 09/14/2016 04:00 PM, Lukas Slebodnik wrote:
>>> Let's assume that we will add new type of cache in future
>>> (e.g. SSS_SYSDB_SECRET_CACHE)
>>>
>>> If the value of "state_mask" was CACHE | TS_CACHE SECRET_CACHE
>>> then this condition would be true but return incorrent string.
>>
>>So, I did it more dynamic way now. See attached patch please.
>>
>The more dynamic way does not work performance decradation
>caused by many useless memory allocations.
>
>Your patch calls get_attr_storage every time
>even though the result would not be used
>due to low debug_level
>
>I prefer one of your previous versions
>e.g.
>+static const char *get_attr_storage(int state_mask)
>+{
>+    const char *storage = "";
or maybe default can be "unknown"

>+
>+    if (state_mask == SSS_SYSDB_BOTH_CACHE ) {
>+        storage = "cache, ts_cache";
>+    } else if (state_mask == SSS_SYSDB_TS_CACHE) {
>+        storage = "ts_cache";
>+    } else if (state_mask == SSS_SYSDB_CACHE) {
>+        storage = "cache";
>+    }
>+
>+    return storage;
>+}
>+
>
>Overhead is minimal and the wrong result will not be printed
>in case of addition new tye of cache.
>
LS
_______________________________________________
sssd-devel mailing list -- sssd-devel@lists.fedorahosted.org
To unsubscribe send an email to sssd-devel-le...@lists.fedorahosted.org

Reply via email to