From 5aacd1be12682e2e13be063df03a348d6ae2ec82 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Tue, 16 Apr 2013 19:22:40 +0900 Subject: [PATCH] fix: xorg-x11-drv-exynos build-break Change-Id: Idab429fb8bcced50b1d74f7376e00836aa02395e --- common/xdbg_evlog.c | 36 ++++++++++++++++++------------------ common/xdbg_evlog_event.c | 4 ++-- common/xdbg_evlog_request.c | 6 +++--- common/xdbg_types.h | 2 +- lib/xdbg_log.h | 10 ++++++++++ 5 files changed, 34 insertions(+), 24 deletions(-) diff --git a/common/xdbg_evlog.c b/common/xdbg_evlog.c index b80dec5..eaae2d6 100644 --- a/common/xdbg_evlog.c +++ b/common/xdbg_evlog.c @@ -114,7 +114,7 @@ xDbgEvlogRuleSet (const int argc, const char **argv, char *reply, int *len) if (argc < 3) { - XDBG_REPLY ("Error : Too few arguments.\n"); + REPLY ("Error : Too few arguments.\n"); return FALSE; } @@ -124,7 +124,7 @@ xDbgEvlogRuleSet (const int argc, const char **argv, char *reply, int *len) policy_type = DENY; else { - XDBG_REPLY ("Error : Unknown policy : [%s].\n Policy should be ALLOW or DENY.\n", policy); + REPLY ("Error : Unknown policy : [%s].\n Policy should be ALLOW or DENY.\n", policy); return FALSE; } @@ -133,16 +133,16 @@ xDbgEvlogRuleSet (const int argc, const char **argv, char *reply, int *len) result = rulechecker_add_rule (rc, policy_type, rule); if (result == RC_ERR_TOO_MANY_RULES) { - XDBG_REPLY ("Error : Too many rules were added.\n"); + REPLY ("Error : Too many rules were added.\n"); return FALSE; } else if (result == RC_ERR_PARSE_ERROR) { - XDBG_REPLY ("Error : An error occured during parsing the rule [%s]\n", rule); + REPLY ("Error : An error occured during parsing the rule [%s]\n", rule); return FALSE; } - XDBG_REPLY ("The rule was successfully added.\n\n"); + REPLY ("The rule was successfully added.\n\n"); rulechecker_print_rule (rc, reply); return TRUE; } @@ -153,7 +153,7 @@ xDbgEvlogRuleSet (const int argc, const char **argv, char *reply, int *len) if (argc < 2) { - XDBG_REPLY ("Error : Too few arguments.\n"); + REPLY ("Error : Too few arguments.\n"); return FALSE; } @@ -165,15 +165,15 @@ xDbgEvlogRuleSet (const int argc, const char **argv, char *reply, int *len) { rulechecker_destroy (rc); rc = rulechecker_init(); - XDBG_REPLY ("Every rules were successfully removed.\n"); + REPLY ("Every rules were successfully removed.\n"); } else { int index = atoi (remove_idx); if (isdigit (*remove_idx) && rulechecker_remove_rule (rc, index) == 0) - XDBG_REPLY ("The rule [%d] was successfully removed.\n", index); + REPLY ("The rule [%d] was successfully removed.\n", index); else - XDBG_REPLY ("Rule remove fail : No such rule [%s].\n", remove_idx); + REPLY ("Rule remove fail : No such rule [%s].\n", remove_idx); } } rulechecker_print_rule (rc, reply); @@ -186,11 +186,11 @@ xDbgEvlogRuleSet (const int argc, const char **argv, char *reply, int *len) } else if (!_strcasecmp (command, "help")) { - XDBG_REPLY ("%s", rulechecker_print_usage()); + REPLY ("%s", rulechecker_print_usage()); return TRUE; } - XDBG_REPLY ("%s\nUnknown command : [%s].\n\n", rulechecker_print_usage(), command); + REPLY ("%s\nUnknown command : [%s].\n\n", rulechecker_print_usage(), command); return TRUE; } @@ -233,7 +233,7 @@ xDbgEvlogFillLog (EvlogInfo *evinfo, char *reply, int *len) RETURN_IF_FAIL (evinfo->type >= 0 && (sizeof (evt_dir) / sizeof (char*))); RETURN_IF_FAIL (evinfo->type >= 0 && (sizeof (evt_type) / sizeof (char*))); - XDBG_REPLY ("[%10.3f][%5ld] %22s(%2d:%5d) %s %s", + REPLY ("[%10.3f][%5ld] %22s(%2d:%5d) %s %s", evinfo->time / 1000.0, evinfo->time - prev, xDbgEvlogGetCmd (evinfo->client.command), @@ -244,15 +244,15 @@ xDbgEvlogFillLog (EvlogInfo *evinfo, char *reply, int *len) if (evinfo->type == REQUEST) { - XDBG_REPLY ("("); + REPLY ("("); reply = xDbgEvlogReqeust (evinfo, reply, len); - XDBG_REPLY (")"); + REPLY (")"); } else if (evinfo->type == EVENT) { - XDBG_REPLY ("("); + REPLY ("("); reply = xDbgEvlogEvent (evinfo, reply, len); - XDBG_REPLY (")"); + REPLY (")"); } else { @@ -261,10 +261,10 @@ xDbgEvlogFillLog (EvlogInfo *evinfo, char *reply, int *len) evlog_name = evinfo->req.name; else if (evinfo->type == EVENT) evlog_name = evinfo->evt.name; - XDBG_REPLY ("(%s)", evlog_name); + REPLY ("(%s)", evlog_name); } - XDBG_REPLY ("\n"); + REPLY ("\n"); prev = evinfo->time; } diff --git a/common/xdbg_evlog_event.c b/common/xdbg_evlog_event.c index 899c351..cbe87f2 100644 --- a/common/xdbg_evlog_event.c +++ b/common/xdbg_evlog_event.c @@ -134,7 +134,7 @@ xDbgEvlogEvent (EvlogInfo *evinfo, char *reply, int *len) if (!_EvlogEventGetExtentionEntry ()) return reply; - XDBG_REPLY ("%s", ev.name); + REPLY ("%s", ev.name); #ifdef XDBG_CLIENT if (xEvt->u.u.type == damage_base + XDamageNotify) @@ -143,7 +143,7 @@ xDbgEvlogEvent (EvlogInfo *evinfo, char *reply, int *len) #endif { xDamageNotifyEvent *damage_e = (xDamageNotifyEvent*)xEvt; - XDBG_REPLY (": XID(%lx) area(%d,%d %dx%d) geo(%d,%d %dx%d)", + REPLY (": XID(%lx) area(%d,%d %dx%d) geo(%d,%d %dx%d)", damage_e->drawable, damage_e->area.x, damage_e->area.y, diff --git a/common/xdbg_evlog_request.c b/common/xdbg_evlog_request.c index d6c14cc..3a4797d 100644 --- a/common/xdbg_evlog_request.c +++ b/common/xdbg_evlog_request.c @@ -127,7 +127,7 @@ _EvlogRequestCore (xReq *req, char *reply, int *len) case X_PutImage: { xPutImageReq *stuff = (xPutImageReq *)req; - XDBG_REPLY (": XID(%lx) size(%dx%d) dst(%d,%d)", + REPLY (": XID(%lx) size(%dx%d) dst(%d,%d)", stuff->drawable, stuff->width, stuff->height, @@ -152,7 +152,7 @@ _EvlogRequestShm (xReq *req, char *reply, int *len) case X_ShmPutImage: { xShmPutImageReq *stuff = (xShmPutImageReq *)req; - XDBG_REPLY (": XID(%lx) size(%dx%d) src(%d,%d %dx%d) dst(%d,%d)", + REPLY (": XID(%lx) size(%dx%d) src(%d,%d %dx%d) dst(%d,%d)", stuff->drawable, stuff->totalWidth, stuff->totalHeight, @@ -186,7 +186,7 @@ xDbgEvlogReqeust (EvlogInfo *evinfo, char *reply, int *len) if (!_EvlogRequestGetExtentionEntry ()) return reply; - XDBG_REPLY ("%s", req.name); + REPLY ("%s", req.name); if (xReq->reqType < EXTENSION_BASE) { diff --git a/common/xdbg_types.h b/common/xdbg_types.h index 8a19c77..c8fe9c0 100644 --- a/common/xdbg_types.h +++ b/common/xdbg_types.h @@ -54,7 +54,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define GOTO_IF_ERRNO(cond, dst, errno) \ {if (!(cond)) { fprintf (stderr, "[%s] '%s' failed. (err=%s(%d))\n", __FUNCTION__, #cond, strerror(errno), errno); goto dst; }} -#define XDBG_REPLY(fmt, ARG...) \ +#define REPLY(fmt, ARG...) \ do { \ if (reply && len && *len > 0) \ { \ diff --git a/lib/xdbg_log.h b/lib/xdbg_log.h index 78e8a38..554b0be 100644 --- a/lib/xdbg_log.h +++ b/lib/xdbg_log.h @@ -103,6 +103,16 @@ void* xDbgLog (unsigned int module, int logoption, const char *file, #define XDBG_GOTO_IF_FAIL(cond, dst) {if (!(cond)) { ErrorF ("[%s] '%s' failed.\n", __FUNCTION__, #cond); goto dst; }} #define XDBG_GOTO_IF_ERRNO(cond, dst, errno) {if (!(cond)) { ErrorF ("[%s] '%s' failed. (err=%s(%d))\n", __FUNCTION__, #cond, strerror(errno), errno); goto dst; }} +#define XDBG_REPLY(fmt, ARG...) \ + do { \ + if (reply && len && *len > 0) \ + { \ + int s = snprintf (reply, *len, fmt, ##ARG); \ + reply += s; \ + *len -= s; \ + } \ + } while (0) + unsigned int xDbgLogGetModule (char *name); #define _C(b,s) (((b) >> (s)) & 0xFF) -- 2.7.4