From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id BD7D5138620 for ; Wed, 23 Jan 2013 12:05:44 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A1AACE0675; Wed, 23 Jan 2013 12:05:38 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 1DE2EE0675 for ; Wed, 23 Jan 2013 12:05:32 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1BE7E33DB44 for ; Wed, 23 Jan 2013 12:05:31 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id F108BE4092 for ; Wed, 23 Jan 2013 12:05:27 +0000 (UTC) From: "Sven Eden" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sven Eden" Message-ID: <1358878604.f629c855270740437abaf11e046b59cfd1e1710e.yamakuzure@gentoo> Subject: [gentoo-commits] proj/ufed:master commit in: / X-VCS-Repository: proj/ufed X-VCS-Files: ufed-curses.c X-VCS-Directories: / X-VCS-Committer: yamakuzure X-VCS-Committer-Name: Sven Eden X-VCS-Revision: f629c855270740437abaf11e046b59cfd1e1710e X-VCS-Branch: master Date: Wed, 23 Jan 2013 12:05:27 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: b0f1bc6e-cf45-476a-ac95-3b56f7a0d316 X-Archives-Hash: a8954e5e2eb237ac214f9856bccc3708 commit: f629c855270740437abaf11e046b59cfd1e1710e Author: Sven Eden gmx de> AuthorDate: Tue Jan 22 18:16:44 2013 +0000 Commit: Sven Eden gmx de> CommitDate: Tue Jan 22 18:16:44 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=f629c855 Eventually substituted the constant function pointer dereferences (*drawitem) and (*callback) with real function calls. --- ufed-curses.c | 37 +++++++++++++++++++++---------------- 1 files changed, 21 insertions(+), 16 deletions(-) diff --git a/ufed-curses.c b/ufed-curses.c index 0ce279d..41b84ea 100644 --- a/ufed-curses.c +++ b/ufed-curses.c @@ -38,6 +38,7 @@ extern int lineCountMasked; /* internal prototypes */ +int (*callback)(struct item **, int); int (*drawitem)(struct item *, bool); void checktermsize(); void draw(); @@ -170,7 +171,7 @@ void drawitems() { for( ; line < wHeight(List); ) { item->currline = line; // drawitem() and maineventloop() need this - line += (*drawitem)(item, item == currentitem ? TRUE : FALSE); + line += drawitem(item, item == currentitem ? TRUE : FALSE); item = item->next; /* Add blank lines if we reached the end of the @@ -398,6 +399,9 @@ int maineventloop( { const char *temp = subtitle; subtitle=_subtitle; _subtitle=temp; } + { int(*temp)(struct item **, int) = callback; + callback=_callback; + _callback=temp; } { int(*temp)(struct item *, bool) = drawitem; drawitem=_drawitem; _drawitem=temp; } @@ -452,15 +456,15 @@ int maineventloop( } if(item==NULL) continue; - (*drawitem)(currentitem, FALSE); + drawitem(currentitem, FALSE); currentitem = item; if(event.bstate & BUTTON1_DOUBLE_CLICKED) { - result=(*_callback)(¤titem, KEY_MOUSE); + result=callback(¤titem, KEY_MOUSE); if(result>=0) goto exit; } scrollcurrent(); - (*drawitem)(currentitem, TRUE); + drawitem(currentitem, TRUE); } } else if(wmouse_trafo(win(Scrollbar), &event.y, &event.x, FALSE)) { // Only do mouse events if there actually is a scrollbar @@ -554,7 +558,7 @@ int maineventloop( } else #endif { - result=(*_callback)(¤titem, c); + result=callback(¤titem, c); if(result>=0) goto exit; @@ -594,12 +598,12 @@ int maineventloop( case KEY_END: if(currentitem->next!=items) { - (*drawitem)(currentitem, FALSE); + drawitem(currentitem, FALSE); currentitem = items->prev; while (!isLegalItem(currentitem)) currentitem = currentitem->prev; scrollcurrent(); - (*drawitem)(currentitem, TRUE); + drawitem(currentitem, TRUE); } break; @@ -644,10 +648,11 @@ int maineventloop( doupdate(); } exit: - subtitle=_subtitle; - drawitem=_drawitem; - items=_items; - keys=_keys; + subtitle = _subtitle; + callback = _callback; + drawitem = _drawitem; + items = _items; + keys = _keys; if(items!=NULL) { currentitem = items; @@ -663,7 +668,7 @@ exit: */ void resetDisplay() { - (*drawitem)(currentitem, FALSE); + drawitem(currentitem, FALSE); currentitem = items; while (!isLegalItem(currentitem)) currentitem = currentitem->next; @@ -694,10 +699,10 @@ void setNextItem(int count, bool strict) } // End of trying to find a next item if ( (result && strict) || (!strict && skipped) ) { - (*drawitem)(currentitem, FALSE); + drawitem(currentitem, FALSE); currentitem = curr; if (!scrollcurrent()) - (*drawitem)(currentitem, TRUE); + drawitem(currentitem, TRUE); } } @@ -724,10 +729,10 @@ void setPrevItem(int count, bool strict) } // End of trying to find next item if ( (result && strict) || (!strict && skipped) ) { - (*drawitem)(currentitem, FALSE); + drawitem(currentitem, FALSE); currentitem = curr; if (!scrollcurrent()) - (*drawitem)(currentitem, TRUE); + drawitem(currentitem, TRUE); } }