You need to sign in or sign up before continuing.
  • M
    Cleanup for a return statement in source files · 9943276f
    Martin Kletzander 提交于
    Return statements with parameter enclosed in parentheses were modified
    and parentheses were removed. The whole change was scripted, here is how:
    
    List of files was obtained using this command:
    git grep -l -e '\<return\s*([^()]*\(([^()]*)[^()]*\)*)\s*;' |             \
    grep -e '\.[ch]$' -e '\.py$'
    
    Found files were modified with this command:
    sed -i -e                                                                 \
    's_^\(.*\<return\)\s*(\(\([^()]*([^()]*)[^()]*\)*\))\s*\(;.*$\)_\1 \2\4_' \
    -e 's_^\(.*\<return\)\s*(\([^()]*\))\s*\(;.*$\)_\1 \2\3_'
    
    Then checked for nonsense.
    
    The whole command looks like this:
    git grep -l -e '\<return\s*([^()]*\(([^()]*)[^()]*\)*)\s*;' |             \
    grep -e '\.[ch]$' -e '\.py$' | xargs sed -i -e                            \
    's_^\(.*\<return\)\s*(\(\([^()]*([^()]*)[^()]*\)*\))\s*\(;.*$\)_\1 \2\4_' \
    -e 's_^\(.*\<return\)\s*(\([^()]*\))\s*\(;.*$\)_\1 \2\3_'
    9943276f
domain_conf.c 470.6 KB