[Xastir-dev] Awk.c optimization

John Laxson jlaxson at mac.com
Tue Apr 26 17:46:37 EDT 2005


Doesn't quite fit the criteria for one use of the parameter in a  
macro, but inline ought to be close enough, yes?  (Diff still against  
cvs, and I think this is what you were looking for?)

diff -u -r1.25 awk.c
--- awk.c       8 Jan 2005 10:06:51 -0000       1.25
+++ awk.c       26 Apr 2005 21:40:57 -0000
@@ -169,8 +168,10 @@
}
-
-
+/* handles ascii for now */
+static inline fast_toupper(char d) {
+       return (d >= 'a' && d <= 'z' ? d - 32 : d); /* poor (speed)  
man's toupper */
+}
/*
   * awk_find_sym: search symtab for symbol
@@ -184,9 +185,10 @@
      // Create holding spot for both cases of first character, in
      // order to speed up the loop below.
-    c = toupper(name[0]);
+    /*c = toupper(name[0]);*/
      d = name[0];
-
+       c = fast_toupper(d);
+
      // Check through the hash
      //
      for (s = this->hash[AWK_SYM_HASH(name,len)]; s; s = s->next_sym) {

On Apr 26, 2005, at 4:34 PM, Alan Crosswell wrote:

> Make it a macro.  One day they may bring back computers that don't  
> use ASCII:-)
> /a




More information about the Xastir-dev mailing list