c - coccinelle: replace single letter variables (i -> ii) -


i trying improve readability of ca 15k lines of c code. 1 idea replace single letter variable names first 2 letter names (i -> ii etc.), 1 has easier task when looking @ code. please note single letter variables in .h files.

i guess possible go use "rename variable" in 1 ide or (fixing 3 common ones: i, j, s; make difference), if 1 can automate task , smarter (i.e. checking ii variable exists somewhere, renaming i->ii globally may problematic).

the brain dead solution:

@@ identifier id=~ "^i$"; @@ - id + ii  @@ identifier id=~ "^j$"; @@ - id + jj 

but if go through whole alphabet, still have problem code using not great mixture of i,ii,iii, etc.
hence question: there semantic patches doing variable identifier renaming checking name conflicts/resolving these (ie renaming pre-existing ii name ii_qscgy: have unique variable name)? sure, can double down on silly code above searching ii,jj first, made them unique, go single i,j etc. there must better way.

thank help.


Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

html - Outlook 2010 Anchor (url/address/link) -

android - How to create dynamically Fragment pager adapter -