There are comments in this file from slobasso, that suggest removing these 
function static variables.

So here we go.

Bert

---

 source/smartIndent.c |   12 +++---------
 1 files changed, 3 insertions(+), 9 deletions(-)

diff --quilt old/source/smartIndent.c new/source/smartIndent.c
--- old/source/smartIndent.c
+++ new/source/smartIndent.c
@@ -816,12 +816,11 @@ void SmartIndentCB(Widget w, XtPointer c
 */
 static void executeNewlineMacro(WindowInfo *window, smartIndentCBStruct 
*cbInfo)
 {
     windowSmartIndentData *winData =
            (windowSmartIndentData *)window->smartIndentData;
-    /* posValue probably shouldn't be static due to re-entrance issues 
<slobasso> */
-    static DataValue posValue = {INT_TAG, {0}};
+    DataValue posValue = {INT_TAG, {0}};
     DataValue result;
     RestartData *continuation;
     char *errMsg;
     int stat;
     
@@ -887,40 +886,35 @@ Boolean InSmartIndentMacros(WindowInfo *
 */
 static void executeModMacro(WindowInfo *window,smartIndentCBStruct *cbInfo)
 {
     windowSmartIndentData *winData =
            (windowSmartIndentData *)window->smartIndentData;
-    /* args probably shouldn't be static due to future re-entrance issues 
<slobasso> */
-    static DataValue args[2] = {{INT_TAG, {0}}, {STRING_TAG, {0}}};
-    /* after 5.2 release remove inModCB and use new winData->inModMacro value 
*/
-    static int inModCB = False;
+    DataValue args[2] = {{INT_TAG, {0}}, {STRING_TAG, {0}}};
     DataValue result;
     RestartData *continuation;
     char *errMsg;
     int stat;
     
     /* Check for inappropriate calls and prevent re-entering if the macro
        makes a buffer modification */
-    if (winData == NULL || winData->modMacro == NULL || inModCB)
+    if (winData == NULL || winData->modMacro == NULL || winData->inModMacro)
        return;
        
     /* Call modification macro with the position of the modification,
        and the character(s) inserted.  Don't allow
        preemption or time limit.  Execution must not overlap or re-enter */
     args[0].val.n = cbInfo->pos;
     AllocNStringCpy(&args[1].val.str, cbInfo->charsTyped);
 
-    inModCB = True;
     ++(winData->inModMacro);
 
     stat = ExecuteMacro(window, winData->modMacro, 2, args, &result,
         &continuation, &errMsg);
     while (stat == MACRO_TIME_LIMIT)
         stat = ContinueMacro(continuation, &result, &errMsg);
 
     --(winData->inModMacro);
-    inModCB = False;
     
     /* Process errors in macro execution */
     if (stat == MACRO_PREEMPT || stat == MACRO_ERROR)
     {
         DialogF(DF_ERR, window->shell, 1, "Smart Indent",
-- 
NEdit Develop mailing list - [email protected]
http://www.nedit.org/mailman/listinfo/develop

Reply via email to