From: Mark Wooding Date: Tue, 1 Oct 2019 17:41:17 +0000 (+0100) Subject: utils/macros.h: Add and `foocmp' helper macros. X-Git-Tag: 2.5.0~4 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/mLib/commitdiff_plain/3618811496a6d131fd4bffa19e262c521d39e819?hp=3618811496a6d131fd4bffa19e262c521d39e819 utils/macros.h: Add and `foocmp' helper macros. 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. ---