enum mime_token {
MUTT_MIME_TOKEN_UNKNOWN,
-`tr 'a-z-' 'A-Z_' | sed -e 's/.*/ MIME_&,/'`
+`tr 'a-z-/' 'A-Z__' | sed -e 's/.*/ MIME_&,/'`
};
__attribute__((pure))
}
do_c() {
- cat <<EOF | gperf --ignore-case -l -t -C -F,0
+ cat <<EOF | gperf --ignore-case -m16 -l -t -C -F",0" -Nmime_which_token_aux
%{
`do_hdr`
-#include <lib-lib/str.h>
+#include <lib-lib/lib-lib.h>
#include "mime-token.h"
+static const struct tok *
+mime_which_token_aux(const char *str, unsigned int len);
+
%}
struct tok { const char *name; int val; };
%%
`awk '{print $0 ", " NR }'`
%%
-enum mime_token mime_which_token(const char *s, ssize_t len) {
- const struct tok *res;
-
+enum mime_token mime_which_token(const char *s, ssize_t len)
+{
if (len < 0)
len = m_strlen(s);
- if (!len)
- return MUTT_MIME_TOKEN_UNKNOWN;
- res = in_word_set(s, len);
- return res ? res->val : MUTT_MIME_TOKEN_UNKNOWN;
+ if (len) {
+ const struct tok *res = mime_which_token_aux(s, len);
+ return res ? res->val : MUTT_MIME_TOKEN_UNKNOWN;
+ } else {
+ return MUTT_MIME_TOKEN_UNKNOWN;
+ }
}
EOF
}