Commit fb410b1f authored by mrobinson@webkit.org's avatar mrobinson@webkit.org
Browse files

2010-02-15 Martin Robinson <mrobinson@webkit.org>

        Reviewed by Darin Adler.

        check-webkit-style should not complain about NULL sentinel in calls to g_strconcat and g_strjoin
        https://bugs.webkit.org/show_bug.cgi?id=34834

        * Scripts/webkitpy/style/processors/cpp.py:
        * Scripts/webkitpy/style/processors/cpp_unittest.py:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54808 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent fdf881e0
2010-02-15 Martin Robinson <mrobinson@webkit.org>
Reviewed by Darin Adler.
check-webkit-style should not complain about NULL sentinel in calls to g_strconcat and g_strjoin
https://bugs.webkit.org/show_bug.cgi?id=34834
* Scripts/webkitpy/style/processors/cpp.py:
* Scripts/webkitpy/style/processors/cpp_unittest.py:
2010-02-12 Alexey Proskuryakov <ap@apple.com>
 
Reviewed by Kevin Decker.
......
......@@ -1868,6 +1868,10 @@ def check_for_null(file_extension, clean_lines, line_number, error):
if search(r'\bg_object_[sg]et\b', line):
return
# Don't warn about NULL usage in g_str{join,concat}(). See Bug 34834
if search(r'\bg_str(join|concat)\b', line):
return
if search(r'\bNULL\b', line):
error(line_number, 'readability/null', 5, 'Use 0 instead of NULL.')
return
......
......@@ -3392,13 +3392,26 @@ class WebKitStyleTest(CppStyleTestBase):
'',
'foo.m')
# Make sure that the NULL check does not apply to g_object_{set,get}
# Make sure that the NULL check does not apply to g_object_{set,get} and
# g_str{join,concat}
self.assert_lint(
'g_object_get(foo, "prop", &bar, NULL);',
'')
self.assert_lint(
'g_object_set(foo, "prop", bar, NULL);',
'')
self.assert_lint(
'gchar* result = g_strconcat("part1", "part2", "part3", NULL);',
'')
self.assert_lint(
'gchar* result = g_strconcat("part1", NULL);',
'')
self.assert_lint(
'gchar* result = g_strjoin(",", "part1", "part2", "part3", NULL);',
'')
self.assert_lint(
'gchar* result = g_strjoin(",", "part1", NULL);',
'')
# 2. C++ and C bool values should be written as true and
# false. Objective-C BOOL values should be written as YES and NO.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment