[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nmh-commits] CVS: nmh/h fmt_scan.h,,1.2

From: Jeffrey C Honig <address@hidden>
Subject: [Nmh-commits] CVS: nmh/h fmt_scan.h,,1.2
Date: Sun, 10 Aug 2003 21:20:54 -0400

Update of /cvsroot/nmh/nmh/h
In directory subversions:/tmp/cvs-serv19427/h

Modified Files:
Log Message:
When compiling format strings, nmh attempts to avoid multiple parsing
of address and date fields by only inserting calls to the parse
functions (FT_PARSEADDR and FT_PARSEDATE) for a given component once.
The problem with this method is that the initial invocation may
actually be on a code path that is conditionally executed.  This can
result cached copies of data from the fields in previous messages to
be used.

My solution is to move this optimization from compile time to run time.
Address and Date parsing calls (FT_PARSEADDR and FT_PARSEDATE) will
always be included.  Run time flags are used to prevent these functions
from being run more than once per component per message.

The c_flags field has being converted from a boolean to a bit-field to
facilitate maintenance of the new CT_PARSED value.  The result value
that used to be in this field is now the bit CF_TRUE and the
overloaded use of this field by scan() is now the CT_DATEFAB bit.

Some unneeded flags (CT_ADDRPARSE, CT_MYMBOX) have also been removed.

Index: fmt_scan.h
RCS file: /cvsroot/nmh/nmh/h/fmt_scan.h,v
retrieving revision
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** fmt_scan.h  30 Apr 1999 18:08:34 -0000
--- fmt_scan.h  11 Aug 2003 01:20:52 -0000      1.2
*** 35,40 ****
  #define       CT_ADDR       (1<<0)    /* referenced as address    */
  #define       CT_DATE       (1<<1)    /* referenced as date       */
! #define       CT_MYMBOX     (1<<2)    /* "mymbox" test being done */
! #define       CT_ADDRPARSE  (1<<3)    /* address parse being done */
  extern int fmt_norm;
--- 35,45 ----
  #define       CT_ADDR       (1<<0)    /* referenced as address    */
  #define       CT_DATE       (1<<1)    /* referenced as date       */
! /*
!  * c_flags bits
!  */
! #define       CF_TRUE       (1<<0)    /* usually means component is present */
! #define       CF_PARSED     (1<<1)    /* address/date has been parsed */
! #define       CF_DATEFAB    (1<<2)    /* datefield fabricated */
  extern int fmt_norm;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]