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 /libglusterfs/src/libglusterfs.sym | |
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 'libglusterfs/src/libglusterfs.sym')
-rw-r--r-- | libglusterfs/src/libglusterfs.sym | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libglusterfs/src/libglusterfs.sym b/libglusterfs/src/libglusterfs.sym index ca952d51942..2da3e701ef9 100644 --- a/libglusterfs/src/libglusterfs.sym +++ b/libglusterfs/src/libglusterfs.sym @@ -410,6 +410,8 @@ dict_set_int8 dict_set_static_bin dict_set_static_ptr dict_set_str +dict_set_strn +dict_set_nstrn dict_set_uint32 dict_set_uint64 dict_set_flag |