diff options
author | Yaniv Kaul <ykaul@redhat.com> | 2018-08-17 22:29:05 +0300 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-08-27 13:15:05 +0000 |
commit | b76a84be697074e4132120200320671d87f815ae (patch) | |
tree | fb85afef0306622e0e70851ef0f61f0e4451a91d /tools | |
parent | c416327b31d4a5dad619007c13c3e9a06e3cd398 (diff) |
libglusterfs/src/dict.{c,h}: Introduce dict_setn, dict_addn, dict_addn and others.
They all take as a parameter the key length, instead of strlen() it.
In most cases, we know the key length, we just never bothered to save and pass it along.
(We most likely sprintf'ed it earlier and the return value could have been used).
A more interesting addition is dict_set_nstrn() [horrible name. Ideas are welcome].
It accepts both the string length and the key length and avoids strlen() both.
Some of it can be calculated on compile-time, btw.
For example:
dict_set_str (dict, "key", "all");
Should become:
dict_set_nstrn (dict, "key", sizeof ("key"), "all", sizeof ("all"));
Compile-tested only!
Change-Id: Ic2667f445f6c2e22e279505f5ad435788b4b668c
updates: bz#1193929
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
Diffstat (limited to 'tools')
0 files changed, 0 insertions, 0 deletions