char prefixBuf[128], suffixBuf[128];
int prefixSuffixIsHeaderFooter = 0;
const char *tag, *msg;
- char * ret = NULL;
int message_len = entry->len - sizeof(dlogutil_entry_s) - entry->tag_len - 2 /* tag and msg delimiters */;
char priChar = filter_pri_to_char((log_priority)entry->priority);
/* the following code is tragically unreadable */
- size_t numLines;
- char *p;
- size_t bufferSize;
- const char *pm;
-
const char *const pre_color_prefix = get_pre_color((log_priority)entry->priority, colorPrefix && p_format.color);
const char *const pre_color_suffix = get_pre_color((log_priority)entry->priority, colorSuffix && p_format.color);
const char *const post_color_prefix = get_post_color((log_priority)entry->priority, colorPrefix && p_format.color);
const int pre_color_suffix_len = strlen(pre_color_suffix);
const int post_color_suffix_len = strlen(post_color_suffix);
+ size_t numLines;
+ const char *pm;
+
if (prefixSuffixIsHeaderFooter) {
/* we're just wrapping message with a header/footer */
numLines = 1;
/* this is an upper bound--newlines in message may be counted
* extraneously
*/
- bufferSize = (numLines * (pre_color_prefix_len + prefixLen + post_color_prefix_len
- + pre_color_suffix_len + suffixLen + post_color_suffix_len)) + message_len + 1;
+ size_t bufferSize = (numLines * (pre_color_prefix_len + prefixLen + post_color_prefix_len
+ + pre_color_suffix_len + suffixLen + post_color_suffix_len)) + message_len + 1;
+ char *ret;
if (defaultBufferSize >= bufferSize) {
ret = defaultBuffer;
ret[0] = '\0'; /* to start strcat off */
- p = ret;
+ char *p = ret;
pm = msg;
#define SPACE_LEFT (bufferSize - ((p - ret) + 1))