Skip to content

neomutt/coccinelle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coccinelle Scripts

What's Coccinelle?

It's a tool for manipulating C source code. Sure, you can search & replace using your favourite editor, sed or awk, but Coccinelle really understands C.

For example, if x is an integer, replace if (!x) with if (x == 0)

Scripts

These script are works-in-progress. Use with caution. They may, or may not, get used in the NeoMutt project.

Coccinelle Script Test C Description
dprint source Replace Mutt's dprint() with NeoMutt's mutt_debug()
if-assignment source Split up if statements containing an assignment
not-pointer source Only allow if (x) for bools and pointers
not-swap source Swap if (!x) clauses
null-check source Replace if (x == NULL) with if (x)
prototypes source Highlight missing argument names in function prototypes
rename-function Rename a function, reordering the arguments
scoped-for-variable source Reduce the scope of a for loop variable
set-pointer-null Set all pointers to NULL when declared
strcmp Test strcmp-like functions against 0
tidy-return Simplify return statements

Copyright

Unless otherwise stated, these scripts and samples are copyrighted by Richard Russon (flatcap) and released under the GPLv2.

Where Can I Find Coccinelle?