chiark / gitweb /
utils/macros.h: Add <ctype.h> and `foocmp' helper macros.
authorMark Wooding <mdw@distorted.org.uk>
Tue, 1 Oct 2019 17:41:17 +0000 (18:41 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 8 May 2020 12:44:29 +0000 (13:44 +0100)
Both of these have been a nuisance for years.  Do something about it.

The command

git grep -En '\<(is|to)[a-z]+\(|\<(str|mem)[a-z]*cmp\(' -- '*.[ch]'

finds code which it might be good to change.

The hairy Emacs command

(query-replace-regexp
 "\\<\\(\\(str\\|mem\\)\\sw*cmp\\)(\\([^,]*\\), \\([^)]*\\)) \\(==\\|!=\\|<\\|<=\\|>\\|>=\\) 0"
 '(replace-eval-replacement
   . (concat (replace-quote (upcase (match-string 1)))
     "(\\3, \\5, \\4)"))
 nil
 (if (and transient-mark-mode mark-active) (region-beginning))
 (if (and transient-mark-mode mark-active) (region-end))
 nil)

will convert easy cases of `foocmp' calls, but hard ones have to be done
by hand.


No differences found