]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Removed dependency on sort command for export list.
authorGuenter Knauf <fuankg@apache.org>
Thu, 31 Mar 2011 05:21:20 +0000 (05:21 +0000)
committerGuenter Knauf <fuankg@apache.org>
Thu, 31 Mar 2011 05:21:20 +0000 (05:21 +0000)
Added a shell sort function to the NetWare export script
which is only few ms slower than the external sort command;
this makes the export list now identical on all build platforms.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1087185 13f79535-47bb-0310-9956-ffa450edef68

build/NWGNUenvironment.inc
build/NWGNUmakefile
build/make_nw_export.awk

index 2b0cc70ec289f5e4308cb1cc2fcb87d9cbc40f30..e5fc7cef53277fd87d8ef8dd8f462596bf6f145d 100644 (file)
@@ -132,7 +132,6 @@ WIN_CC      = mwcc
 
 # Setup build tools
 AWK    = awk
-SORT   = sort
 
 # Setup distribution tools
 ZIP    = zip -qr9
index fe228b4029773af4a2e43c9d72b9226357320333..8e588aeae733aeea4854b4df0e6b0a07d6670c1d 100644 (file)
@@ -29,11 +29,11 @@ libs :: chkapr $(NWOS)/chartables.c
 
 $(DAV)/main/dav.imp : make_nw_export.awk $(DAV)/main/mod_dav.h
        @echo $(DL)GEN  $@$(DL)
-       $(AWK) -v EXPPREFIX=AP$(VERSION_MAJMIN) -f $^ | $(SORT) >$@
+       $(AWK) -v EXPPREFIX=AP$(VERSION_MAJMIN) -f $^ >$@
 
 $(NWOS)/httpd.imp : make_nw_export.awk nw_export.i
        @echo $(DL)GEN  $@$(DL)
-       $(AWK) -v EXPPREFIX=AP$(VERSION_MAJMIN) -f $^ | $(SORT) >$@
+       $(AWK) -v EXPPREFIX=AP$(VERSION_MAJMIN) -f $^ >$@
     
 nw_export.i : nw_export.inc $(FILES_prebuild_headers) cc.opt
        @echo $(DL)GEN  $@$(DL)
index f2e1c9046b4dcbbbd16bb6a3debad1076057b9b1..52f43e531c958eaa28860d5e97a425fde3343ab9 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-#
 # Based on apr's make_export.awk, which is
 # based on Ryan Bloom's make_export.pl
+#
 
 BEGIN {
-    printf(" (%s)\n", EXPPREFIX)
+}
+
+function add_symbol(sym_name) {
+    sub(" ", "", sym_name)
+    exports[++idx] = sym_name
 }
 
 # List of functions that we don't support, yet??
@@ -84,14 +88,31 @@ BEGIN {
     add_symbol($NF)
 }
 
-#END {
-#    printf("\n\n#found: %d symbols.\n", found)
-#}
 
-function add_symbol(sym_name) {
-    found++
-    sub (" ", "", sym_name)
-    printf(" %s,\n", sym_name)
+END {
+    printf("Added %d symbols to export list.\n", idx) > "/dev/stderr"
+    # sort symbols with shell sort
+    increment = int(idx / 2)
+    while (increment > 0) {
+        for (i = increment+1; i <= idx; i++) {
+            j = i
+            temp = exports[i]
+            while ((j >= increment+1) && (exports[j-increment] > temp)) {
+                exports[j] = exports[j-increment]
+                j -= increment
+            }
+            exports[j] = temp
+        }
+        if (increment == 2)
+            increment = 1
+        else
+            increment = int(increment*5/11)
+    }
+    # print the array
+    printf(" (%s)\n", EXPPREFIX)
+    while (x < idx - 1) {
+        printf(" %s,\n", exports[++x])
+    }
+    printf(" %s\n", exports[++x])
 }
 
-