2007-10-02 Eric Blake <ebb9@byu.net>
+ Optimize appending text.
+ * lib/m4sugar/m4sugar.m4 (m4_append_uniq): Use index, not regular
+ expressions.
+
Optimize recursion.
* lib/m4sugar/m4sugar.m4 (m4_shiftn): This macro is called in a
lot of hot spots; optimize it for 2 and 3 shifts.
# m4_append_uniq(MACRO-NAME, STRING, [SEPARATOR])
# -----------------------------------------------
-# As `m4_append', but append only if not yet present.
+# Like `m4_append', but append only if not yet present.
m4_define([m4_append_uniq],
[m4_ifdef([$1],
- [m4_bmatch([$3]m4_defn([$1])[$3], m4_re_escape([$3$2$3]), [],
- [m4_append($@)])],
+ [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
+ [m4_append($@)])],
[m4_append($@)])])