Work around lcc's annoying (but, even more annoyingly, legitimate)
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sat, 19 Mar 2005 16:34:58 +0000 (16:34 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sat, 19 Mar 2005 16:34:58 +0000 (16:34 +0000)
refusal to allow comparison of function pointers. Unfortunately this
still doesn't cause PuTTY to compile on my lcc installation, because
the GetCharacterPlacement stuff in exact_textout() is missing from
its header files. This may have been fixed in a future version (I'm
using lcc-win32 version 3.8 from December 2003), but I haven't
checked.

git-svn-id: svn://svn.tartarus.org/sgt/putty@5527 cda61777-01e9-0310-a592-d414129be87e

timing.c

index a87be89..6dd8aa5 100644 (file)
--- a/timing.c
+++ b/timing.c
@@ -41,10 +41,21 @@ static int compare_timers(void *av, void *bv)
      * Failing that, compare on the other two fields, just so that
      * we don't get unwanted equality.
      */
+#ifdef __LCC__
+    /* lcc won't let us compare function pointers. Legal, but annoying. */
+    {
+       int c = memcmp(&a->fn, &b->fn, sizeof(a->fn));
+       if (c < 0)
+           return -1;
+       else if (c > 0)
+           return +1;
+    }
+#else    
     if (a->fn < b->fn)
        return -1;
     else if (a->fn > b->fn)
        return +1;
+#endif
 
     if (a->ctx < b->ctx)
        return -1;