h_core_bool_t _h_audit_log_trace(h_audit_log_t *log, const char *system, const char *entry, const char *file, unsigned long line, ...) { assert(log); assert(system); assert(entry); assert(file); char *traced_entry; char interpolated_entry[MAX_ENTRY_SIZE]; char *formatted_entry; va_list ap; h_core_bool_t success; h_core_time_string_t time_string; success = h_core_bool_false; if (h_core_get_current_time_string(time_string)) { if (asprintf(&traced_entry, "%s [%4s] X %s() in %s:%lu", time_string, system, entry, file, line) != -1) { va_start(ap, line); if (vsnprintf(interpolated_entry, MAX_ENTRY_SIZE, traced_entry, ap) != -1) { formatted_entry = format_entry(interpolated_entry); if (formatted_entry) { if (write_entry_to_all_files(log, formatted_entry)) { success = h_core_bool_true; } else { h_core_trace("write_entry_to_all_files"); } free(formatted_entry); } else { h_core_trace("format_entry"); } } else { h_core_trace("asprintf"); } va_end(ap); free(traced_entry); } else { h_core_trace("asprintf"); } } else { h_core_trace("h_core_get_current_time_string"); } return success; }
static int paint_entry(Calendar *c, int x, int y, int maxchars, Paint_cache *cache_entry, XRectangle *rect) { XFontSetExtents fontextents; Props *p = (Props*)c->properties; int nlines = 0, dt = get_int_prop(p, CP_DEFAULTDISP); new_XContext *xc = c->xcontext; char buf1[50], buf2[WHAT_LEN+1]; Week *w = (Week *)c->view->week_info; Tick tick; /* * Write an appointment entry into a day */ if (maxchars >= 40) /* maxed out possible=40 */ maxchars = 40; buf1[0] = '\0'; buf2[0] = '\0'; format_entry(cache_entry, buf1, buf2, dt); tick = cache_entry->start_time; if (cache_entry->show_time && !magic_time(tick) && (buf1[0] != '\0')) { maxchars = gr_nchars(w->day_width - 5, buf1,c->fonts->boldfont); buf1[min(cm_strlen(buf1), maxchars)] = '\0'; gr_text(xc, x, y, c->fonts->boldfont, buf1, rect); nlines++; CalFontExtents(c->fonts->boldfont, &fontextents); y += fontextents.max_logical_extent.height;; } if (buf2[0] != '\0') { maxchars = gr_nchars(w->day_width - 5, buf2, c->fonts->viewfont); buf2[min(cm_strlen(buf2), maxchars)] = '\0'; gr_text(xc, x, y, c->fonts->viewfont, buf2, rect); nlines++; } return(nlines); }