[Bugs] [Bug 1193929] GlusterFS can be improved

bugzilla at redhat.com bugzilla at redhat.com
Mon Aug 27 13:29:25 UTC 2018


https://bugzilla.redhat.com/show_bug.cgi?id=1193929



--- Comment #294 from Worker Ant <bugzilla-bot at gluster.org> ---
COMMIT: https://review.gluster.org/20769 committed in master by "Amar Tumballi"
<amarts at redhat.com> with a commit message- 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 at redhat.com>

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.


More information about the Bugs mailing list