Index: trunk/src/opengl/glu/nurbs/internals/sorter.cpp
===================================================================
--- trunk/src/opengl/glu/nurbs/internals/sorter.cpp	(revision 4310)
+++ trunk/src/opengl/glu/nurbs/internals/sorter.cpp	(revision 4311)
@@ -1,3 +1,3 @@
-/* $Id: sorter.cpp,v 1.1 2000-02-09 08:50:28 jeroen Exp $ */
+/* $Id: sorter.cpp,v 1.2 2000-09-22 20:49:20 jeroen Exp $ */
 /*
 ** License Applicability. Except to the extent portions of this file are
@@ -37,6 +37,6 @@
  * sorter.c++
  *
- * $Date: 2000-02-09 08:50:28 $ $Revision: 1.1 $
- * $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glu/nurbs/internals/sorter.cpp,v 1.1 2000-02-09 08:50:28 jeroen Exp $
+ * $Date: 2000-09-22 20:49:20 $ $Revision: 1.2 $
+ * $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glu/nurbs/internals/sorter.cpp,v 1.2 2000-09-22 20:49:20 jeroen Exp $
  */
 
@@ -81,62 +81,69 @@
 {
     char *i, *j;
-    char	*lp, *hp;
-    int	c;
+    char        *lp, *hp;
+    int c;
     unsigned int n;
+    int redo=1;
 
-start:
+//start:
+while(redo)
+  {
+    redo=0;
+
     if((n=l-a) <= es)
-	    return;
+            return;
     n = es * (n / (2*es));
     hp = lp = a+n;
     i = a;
     j = l-es;
-    while(1) {
-	if(i < lp) {
-	    if((c = qscmp(i, lp)) == 0) {
-		qsexc(i, lp -= es);
-		continue;
-	    }
-	    if(c < 0) {
-		i += es;
-		continue;
-	    }
-	}
+    while(1)
+    {
+        if(i < lp) {
+            if((c = qscmp(i, lp)) == 0) {
+                qsexc(i, lp -= es);
+                continue;
+            }
+            if(c < 0) {
+                i += es;
+                continue;
+            }
+        }
 
 loop:
-	if(j > hp) {
-	    if((c = qscmp(hp, j)) == 0) {
-		qsexc(hp += es, j);
-		goto loop;
-	    }
-	    if(c > 0) {
-		if(i == lp) {
-		    qstexc(i, hp += es, j);
-		    i = lp += es;
-		    goto loop;
-		}
-		qsexc(i, j);
-		j -= es;
-		i += es;
-		continue;
-	    }
-	    j -= es;
-	    goto loop;
-	}
+        if(j > hp) {
+            if((c = qscmp(hp, j)) == 0) {
+                qsexc(hp += es, j);
+                goto loop;
+            }
+            if(c > 0) {
+                if(i == lp) {
+                    qstexc(i, hp += es, j);
+                    i = lp += es;
+                    goto loop;
+                }
+                qsexc(i, j);
+                j -= es;
+                i += es;
+                continue;
+            }
+            j -= es;
+            goto loop;
+        }
 
-	if(i == lp) {
-	    if(lp-a >= l-hp) {
-		qs1(hp+es, l);
-		l = lp;
-	    } else {
-		qs1(a, lp);
-		a = hp+es;
-	    }
-	    goto start;
-	}
+        if(i == lp) {
+            if(lp-a >= l-hp) {
+                qs1(hp+es, l);
+                l = lp;
+            } else {
+                qs1(a, lp);
+                a = hp+es;
+            }
+            /*goto start;*/ redo=1; break;
+        }
 
-	qstexc(j, lp -= es, i);
-	j = hp -= es;
+        qstexc(j, lp -= es, i);
+        j = hp -= es;
     }
+  }
 }
 
Index: trunk/src/opengl/mesa/glthread.c
===================================================================
--- trunk/src/opengl/mesa/glthread.c	(revision 4310)
+++ trunk/src/opengl/mesa/glthread.c	(revision 4311)
@@ -1,3 +1,3 @@
-/* $Id: glthread.c,v 1.1 2000-05-23 20:40:36 jeroen Exp $ */
+/* $Id: glthread.c,v 1.2 2000-09-22 20:49:20 jeroen Exp $ */
 
 /*
@@ -63,4 +63,14 @@
 #define INIT_MAGIC 0xff8adc98
 
+#ifdef __WIN32OS2__
+#include <odinwrap.h>
+inline void ** __threadstore()
+{
+  USHORT sel=RestoreOS2FS();
+  void **p=_threadstore();
+  SetFS(sel);
+  return p;
+}
+#endif
 
 
@@ -248,23 +258,23 @@
 _glthread_GetID(void)
 {
-   return (unsigned long) _threadstore();
-}
-
-
-void
-_glthread_InitTSD(_glthread_TSD *tsd)
-{
-   tsd->key = (ULONG) (_threadstore());
-   tsd->initMagic = INIT_MAGIC;
-}
-
-
-void *
-_glthread_GetTSD(_glthread_TSD *tsd)
-{
-   if (tsd->initMagic != INIT_MAGIC) {
-      _glthread_InitTSD(tsd);
-   }
-   return _threadstore();
+   return (unsigned long) __threadstore();
+}
+
+
+void
+_glthread_InitTSD(_glthread_TSD *tsd)
+{
+   tsd->key = (ULONG) (__threadstore());
+   tsd->initMagic = INIT_MAGIC;
+}
+
+
+void *
+_glthread_GetTSD(_glthread_TSD *tsd)
+{
+   if (tsd->initMagic != INIT_MAGIC) {
+      _glthread_InitTSD(tsd);
+   }
+   return __threadstore();
 }
 
@@ -279,5 +289,5 @@
    }
 
-   (*_threadstore())=(void *)ptr;
+   (*__threadstore())=(void *)ptr;
 }
 
