Last active
April 14, 2017 19:37
-
-
Save amalloy/645cd1acdb1fccabe61bb18fdc7fb803 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun ptr-to-ref (symbol) | |
(interactive "sConvert local pointer variable to reference: ") | |
(save-excursion | |
(narrow-to-defun) | |
(unwind-protect | |
(dolist (replacement (list (cons (concat "\\b" symbol "\\b\\([^*&_-]\\)") | |
(concat "&" symbol "\\1")) | |
(cons (concat "\\b" symbol "->") | |
(concat symbol ".")) | |
(cons (concat "\\*&" symbol) | |
symbol))) | |
(beginning-of-buffer) | |
(search-forward ")") | |
(while (re-search-forward (car replacement) nil t) | |
(replace-match (cdr replacement)))) | |
(widen)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for fname in $@ | |
do | |
find . -name '*.cc' | xargs perl -pi -e "s/(\\b$fname\\()/\$1*/g unless (m/^\w+\[*&]* $fname/m);" | |
find . -name '*.cc' | xargs perl -pi -e "s/(\\b$fname\\()\*&/\$1/g;" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment