Convert printf_errf/dbgf in several files

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2018-12-20 16:54:51 +00:00
parent 3966491846
commit b5b0f4af7f
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
4 changed files with 15 additions and 14 deletions

View File

@ -4064,8 +4064,8 @@ write_binary_data(const char *path, const unsigned char *data, int length) {
int wrote_len = fwrite(data, sizeof(unsigned char), length, f);
fclose(f);
if (wrote_len != length) {
printf_errf("(\"%s\"): Failed to write all blocks: %d / %d", path,
wrote_len, length);
log_error("Failed to write all blocks: %d / %d to %s",
wrote_len, length, path);
return false;
}
return true;

View File

@ -134,7 +134,7 @@ static inline bool
wid_set_text_prop(session_t *ps, Window wid, Atom prop_atom, char *str) {
XTextProperty *pprop = make_text_prop(ps, str);
if (!pprop) {
printf_errf("(\"%s\"): Failed to make text property.", str);
log_error("Failed to make text property: %s.", str);
return false;
}
@ -155,10 +155,11 @@ dump_drawable(session_t *ps, Drawable drawable) {
unsigned width = 0, height = 0, border = 0, depth = 0;
if (XGetGeometry(ps->dpy, drawable, &rroot, &x, &y, &width, &height,
&border, &depth)) {
printf_dbgf("(%#010lx): x = %u, y = %u, wid = %u, hei = %d, b = %u, d = %u\n", drawable, x, y, width, height, border, depth);
log_trace("Drawable %#010lx: x = %u, y = %u, wid = %u, hei = %d, b = %u, d = %u",
drawable, x, y, width, height, border, depth);
}
else {
printf_dbgf("(%#010lx): Failed\n", drawable);
log_trace("Drawable %#010lx: Failed", drawable);
}
}

10
src/x.c
View File

@ -112,7 +112,7 @@ static inline void x_get_server_pictfmts(session_t *ps) {
xcb_render_query_pict_formats_reply(ps->c,
xcb_render_query_pict_formats(ps->c), &e);
if (e || !ps->pictfmts) {
printf_errf("(): failed to get pict formats\n");
log_fatal("failed to get pict formats\n");
abort();
}
}
@ -142,8 +142,8 @@ x_create_picture_with_pictfmt_and_pixmap(
if (attr) {
xcb_render_create_picture_value_list_serialize(&buf, valuemask, attr);
if (!buf) {
printf_errf("(): failed to serialize picture attributes");
return None;
log_error("failed to serialize picture attributes");
return XCB_NONE;
}
}
@ -153,8 +153,8 @@ x_create_picture_with_pictfmt_and_pixmap(
pixmap, pictfmt->id, valuemask, buf));
free(buf);
if (e) {
printf_errf("(): failed to create picture");
return None;
log_error("failed to create picture");
return XCB_NONE;
}
return tmp_picture;
}

View File

@ -40,8 +40,8 @@ xrc_delete_xid_(XID xid, M_POS_DATA_PARAMS) {
xrc_xid_record_t *prec = NULL;
HASH_FIND_XID(gs_xid_records, &xid, prec);
if (!prec) {
printf_err("XRC: %s:%d %s(): Can't find XID %#010lx we want to delete.",
file, line, func, xid);
log_error("XRC: %s:%d %s(): Can't find XID %#010lx we want to delete.",
file, line, func, xid);
return;
}
HASH_DEL(gs_xid_records, prec);
@ -54,8 +54,8 @@ xrc_delete_xid_(XID xid, M_POS_DATA_PARAMS) {
void
xrc_report_xid(void) {
for (xrc_xid_record_t *prec = gs_xid_records; prec; prec = prec->hh.next)
printf_dbg("XRC: %s:%d %s(): %#010lx (%s) not freed.\n",
prec->file, prec->line, prec->func, prec->xid, prec->type);
log_trace("XRC: %s:%d %s(): %#010lx (%s) not freed.\n",
prec->file, prec->line, prec->func, prec->xid, prec->type);
}
/**