diff options
author | Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br> | 2008-09-22 17:05:21 -0300 |
---|---|---|
committer | Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br> | 2008-09-22 17:05:21 -0300 |
commit | 6b5c22d8680573c8a6b259d78ba3c8435514fde9 (patch) | |
tree | af0cfdbbff3e602143957c92e98a113a71de1415 /src/smi_dga.c | |
parent | cf7097c19b31671a53bc8161bd29b9f79f1d3d85 (diff) |
Rework/simplify debug macros.
Instead of cut&paste of the name of the current function everywhere,
just use cpp's __FUNCTION__ predefined macro.
Create two macros to exit a function, named LEAVE() and RETURN().
Functions returning void should call LEAVE() and then explicitly return
for now. "Logged" function calls are indented, so a review was done to
ensure functions with a ENTER() also have the proper exit macro.
The DEBUG macro was changed to have variadic arguments, and this way
it is no longer required to prefix arguments with VERBLEV, but now it
also is not possible to use another "verbosity value", but it wasn't used
in any of the DEBUG macro calls.
Diffstat (limited to 'src/smi_dga.c')
-rw-r--r-- | src/smi_dga.c | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/src/smi_dga.c b/src/smi_dga.c index a51b0b1..32e6824 100644 --- a/src/smi_dga.c +++ b/src/smi_dga.c @@ -76,7 +76,7 @@ SMI_DGAInit(ScreenPtr pScreen) int num = 0; Bool ret; - ENTER_PROC("SMI_DGAInit"); + ENTER(); pMode = firstMode = pScrn->modes; @@ -84,8 +84,7 @@ SMI_DGAInit(ScreenPtr pScreen) newmodes = xrealloc(modes, (num + 1) * sizeof(DGAModeRec)); if (newmodes == NULL) { xfree(modes); - LEAVE_PROC("SMI_DGAInit"); - return FALSE; + RETURN(FALSE); } modes = newmodes; @@ -144,8 +143,8 @@ SMI_DGAInit(ScreenPtr pScreen) pSmi->DGAModes = modes; ret = DGAInit(pScreen, &SMI_DGAFuncs, modes, num); - LEAVE_PROC("SMI_DGAInit"); - return ret; + + RETURN(ret); } static Bool @@ -155,7 +154,7 @@ SMI_SetMode(ScrnInfoPtr pScrn, DGAModePtr pMode) int index = pScrn->pScreen->myNum; SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_SetMode"); + ENTER(); if (pMode == NULL) { /* restore the original mode */ @@ -178,8 +177,7 @@ SMI_SetMode(ScrnInfoPtr pScrn, DGAModePtr pMode) SMI_SwitchMode(index, pMode->mode, 0); } - LEAVE_PROC("SMI_SetMode"); - return TRUE; + RETURN(TRUE); } @@ -188,11 +186,9 @@ SMI_GetViewport(ScrnInfoPtr pScrn) { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_GetViewport"); - - LEAVE_PROC("SMI_GetViewport"); + ENTER(); - return pSmi->DGAViewportStatus; + RETURN(pSmi->DGAViewportStatus); } static void @@ -200,12 +196,12 @@ SMI_SetViewport(ScrnInfoPtr pScrn, int x, int y, int flags) { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_SetViewport"); + ENTER(); SMI_AdjustFrame(pScrn->pScreen->myNum, x, y, flags); pSmi->DGAViewportStatus = 0; - LEAVE_PROC("SMI_SetViewport"); + LEAVE(); } static void @@ -213,7 +209,7 @@ SMI_FillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned long color) { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_FillRect"); + ENTER(); if (pSmi->XAAInfoRec) { (*pSmi->XAAInfoRec->SetupForSolidFill)(pScrn, color, GXcopy, ~0); @@ -221,7 +217,7 @@ SMI_FillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned long color) SET_SYNC_FLAG(pSmi->XAAInfoRec); } - LEAVE_PROC("SMI_FillRect"); + LEAVE(); } static void @@ -230,7 +226,7 @@ SMI_BlitRect(ScrnInfoPtr pScrn, int srcx, int srcy, int w, int h, int dstx, { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_BlitRect"); + ENTER(); if (pSmi->XAAInfoRec) { int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; @@ -241,7 +237,7 @@ SMI_BlitRect(ScrnInfoPtr pScrn, int srcx, int srcy, int w, int h, int dstx, SET_SYNC_FLAG(pSmi->XAAInfoRec); } - LEAVE_PROC("SMI_BlitRect"); + LEAVE(); } static void @@ -250,7 +246,7 @@ SMI_BlitTransRect(ScrnInfoPtr pScrn, int srcx, int srcy, int w, int h, int dstx, { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_BlitTraneRect"); + ENTER(); if (pSmi->XAAInfoRec) { int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; @@ -261,7 +257,7 @@ SMI_BlitTransRect(ScrnInfoPtr pScrn, int srcx, int srcy, int w, int h, int dstx, SET_SYNC_FLAG(pSmi->XAAInfoRec); } - LEAVE_PROC("SMI_BlitTraneRect"); + LEAVE(); } static Bool @@ -270,7 +266,7 @@ SMI_OpenFramebuffer(ScrnInfoPtr pScrn, char **name, unsigned char **mem, { SMIPtr pSmi = SMIPTR(pScrn); - ENTER_PROC("SMI_OpenFrameBuffer"); + ENTER(); *name = NULL; /* no special device */ *mem = (unsigned char*)pSmi->FBBase; @@ -278,7 +274,6 @@ SMI_OpenFramebuffer(ScrnInfoPtr pScrn, char **name, unsigned char **mem, *offset = 0; *flags = DGA_NEED_ROOT; - LEAVE_PROC("SMI_OpenFrameBuffer"); - return TRUE; + RETURN(TRUE); } |