Index: include/click/glue.hh
===================================================================
RCS file: /cvs/click/release/one/include/click/glue.hh,v
retrieving revision 1.55
diff -u -r1.55 glue.hh
--- include/click/glue.hh	3 Feb 2007 18:35:16 -0000	1.55
+++ include/click/glue.hh	22 May 2007 05:25:47 -0000
@@ -128,6 +128,7 @@
 
 void click_qsort(void *base, size_t n, size_t size, int (*compar)(const void *, const void *, void *), void *thunk);
 void click_qsort(void *base, size_t n, size_t size, int (*compar)(const void *, const void *));
+void click_ssort(void *base, size_t n, size_t size, int (*compar)(const void *, const void *));
 
 
 // OTHER
Index: lib/glue.cc
===================================================================
RCS file: /cvs/click/release/one/lib/glue.cc,v
retrieving revision 1.55
diff -u -r1.55 glue.cc
--- lib/glue.cc	31 Dec 2006 01:54:25 -0000	1.55
+++ lib/glue.cc	22 May 2007 05:25:47 -0000
@@ -470,6 +470,40 @@
     click_qsort_subroutine(base, size, 0, n - 1, compar2, 0);
 }
 
+void*
+click_ssort_pos(void* base, unsigned pos, size_t size)
+{
+	return (unsigned char*)base + (pos * size);
+}
+
+void
+click_ssort(void *base, size_t n, size_t size, int (*compar)(const void *, const void *))
+{
+	if (size >= 64) {
+#if CLICK_LINUXMODULE
+		printk("<1>click_qsort_partition: elements too large!\n");
+#elif CLICK_BSDMODULE
+		printf("click_qsort_partition: elements too large!\n");
+#endif
+	}
+	for (size_t i = 0; i < n; i ++) {
+		int maxpos = 0;	
+		for (size_t j = 0; j < n - i; j ++) {
+			void* ptr = click_ssort_pos(base, j, size);
+			int cmp = compar(ptr, click_ssort_pos(base, maxpos, size));
+			if (cmp > 0) {
+				maxpos = j;
+			}
+		}
+		const size_t swappos = n - i - 1;
+		if (maxpos != swappos) {
+			unsigned char tmp[size];
+	    memcpy(&tmp[0], click_ssort_pos(base, maxpos, size) , size);
+	    memcpy(click_ssort_pos(base, maxpos, size), click_ssort_pos(base, swappos, size), size);
+	    memcpy(click_ssort_pos(base, swappos, size), &tmp[0], size);
+		}
+	}
+}
 
 // TIMEVALS AND JIFFIES
 
Index: lib/ino.cc
===================================================================
RCS file: /cvs/click/release/one/lib/ino.cc,v
retrieving revision 1.12
diff -u -r1.12 ino.cc
--- lib/ino.cc	20 Jul 2006 21:34:06 -0000	1.12
+++ lib/ino.cc	22 May 2007 05:25:47 -0000
@@ -107,7 +107,7 @@
     }
 
     // sort _x
-    click_qsort(&_x[1], nelem - 1, sizeof(Entry), entry_compar);
+    click_ssort(&_x[1], nelem - 1, sizeof(Entry), entry_compar);
 
     // add new _x entries for intermediate directories
     int n = nelem;
@@ -134,7 +134,7 @@
  
     // resort _x if necessary
     if (n != nelem)
-	click_qsort(&_x[1], n - 1, sizeof(Entry), entry_compar);
+	click_ssort(&_x[1], n - 1, sizeof(Entry), entry_compar);
 
     // calculate 'skip'
     _x[0].skip = n - 1;
@@ -196,7 +196,7 @@
 
     // sort names
     if (names.size())
-	click_qsort(&names[0], names.size(), sizeof(String), string_compar);
+	click_ssort(&names[0], names.size(), sizeof(String), string_compar);
 
     // run over the arrays, marking conflicts
     int xi = parent_xindex + 1;
