summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2018-07-20 14:27:57 +0530
committerAtin Mukherjee <amukherj@redhat.com>2018-08-14 15:35:21 +0000
commit1f3bfe7b5d437ae3ecd202e0e224a62dbc98b133 (patch)
tree4e02ac75518c8906dbe830d3339668a9f595df07 /doc
parentd339f87a6fadf7bc4d680a657ddc404247e14c47 (diff)
glusterd: fix gcc7 warnings
[sh]$ gcc --version gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5) Warnings were of the type below: xlators/mgmt/glusterd/src/glusterd-store.c:3285:33: warning: ‘/options’ directive output may be truncated writing 8 bytes into a region of size between 1 and 4096 [-Wformat-truncation=] snprintf (path, len, "%s/options", conf->workdir); ^~~~~~~~ xlators/mgmt/glusterd/src/glusterd-store.c:1280:39: warning: ‘/snaps/’ directive output may be truncated writing 7 bytes into a region of size between 1 and 4096 [-Wformat-truncation=] snprintf (snap_fpath, len, "%s/snaps/%s/%s", priv->workdir, ^~~~~~~ * Also changed some places where there was issues with key size * Made sure all the 'char buf[SOMESIZE] = {0,};' are changed to 'char buf[SOMESIZE] = "";` - In the files I changed * Also edited coding standard to reflect that. updates: bz#1193929 Change-Id: I04c652624ac63199cea2077e46b3a5def37c3689 Signed-off-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/developer-guide/coding-standard.md22
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/developer-guide/coding-standard.md b/doc/developer-guide/coding-standard.md
index eb9cd9ddc39..9bc15a5cc15 100644
--- a/doc/developer-guide/coding-standard.md
+++ b/doc/developer-guide/coding-standard.md
@@ -156,6 +156,28 @@ instead.
gf_boolean_t port_inuse[65536]; /* 256KB, this actually happened */
```
+NOTE: Ideal is to limit the stack array to less than 256 bytes.
+
+
+Character array initializing
+----------------------------
+
+It is recommended to keep the character array initializing to empty string.
+
+*Good:*
+```
+char msg[1024] = "";
+```
+
+Not so much recommended, even though it means the same.
+
+```
+char msg[1024] = {0,};
+```
+
+We recommend above to structure initialization.
+
+
Validate all arguments to a function
------------------------------------