On Thu, 17 Mar 2005 19:30:58 GMT, David Woodhouse said:
+ if (*p == '"' || *p == ' ' || *p < 0x20 ||
*p > 0x7f) {
+ audit_log_hex(ab, string, strlen(string));
+ return;
+ }
+ p++;
+ }
+ audit_log_format(ab, "\"%s\"", string);
Hmm.. we either get a "string" or a stream-of-hex-digits, we can identify
which it is by looking at the first byte, we can always unambiguously find
the end, and there's no ambiguous representations, plus the code is relatively
simple. Not bad.
audit_log_hex is almost a one-liner, would probably benefit from an 'inline' or
just open-coding it. Not sure if the inner audit_log_format() call can
be further optimized.