You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Stephen Tyree (JIRA)" <ji...@apache.org> on 2011/04/27 05:21:03 UTC

[jira] [Created] (ZOOKEEPER-1056) Questions and Improvements for the C client codebase

Questions and Improvements for the C client codebase
----------------------------------------------------

                 Key: ZOOKEEPER-1056
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1056
             Project: ZooKeeper
          Issue Type: Bug
          Components: c client
    Affects Versions: 3.4.0
            Reporter: Stephen Tyree
            Priority: Minor


Having been using the C client for a few months now, I thought I'd look through the code and see if anything could be improved and/or fixed in order to be a good citizen. Here are some observations and questions I was hoping people could elaborate on.

- There appears to be a bug in sub_string (zookeeper.c). The third argument being passed into strncmp is a conditional due to misplaced parenthesis, meaning the length is either 0 or 1. This likely leads to many, many false positives of chroots matching paths.
- There appears to be a bug in queue_session_event, where we check for cptr->buffer not being NULL after already dereferencing it
- In both queue_buffer and queue_completion_nolock, we assert a conditional that we just checked for
- What is the policy on whether the result of memory allocations are checked for, assert'd against or ignored? This is done inconsistently.
- What is the policy on whether pointers are checked/set against NULL versus 0? This is done inconsistently.
- Some functions, such as zoo_wget_children2_, exhibit needlessly high cyclomatic complexity
- What is the policy on line length restrictions? Some functions go through hurdles to enforce 80 characters while others do no such thing.
- What is the policy on indentation and spacing of if statements and blocks of code? This is done inconsistently.

If any or all of these turn out to be issues that need to be fixed I'd be more than happy to do so.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira