[comp.sources.misc] v07i097: bug fix to v07i056: July CACM Diff program

allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc) (07/22/89)

Posting-number: Volume 7, Issue 97
Submitted-by: Donald.Lindsay@MATHOM.GANDALF.CS.CMU.EDU
Archive-name: cacm-diff.p1

*************< cut here: diff -c output >************************

*** diff12.c	Tue Jul 18 10:51:20 1989
--- diff13.c	Tue Jul 18 10:51:43 1989
***************
*** 64,69 ****
--- 64,72 ----
  *    read in full, or in a particular order. Rather, this program is an
  *    example of one professional's style of keeping things organized and
  *    maintainable.
+ * The program would be better if the "print" variables were wrapped into
+ *    a struct. In general, grouping related variables in this way improves
+ *    documentation, and adds the ability to pass the group in argument lists.
  * This program is a de-engineered version of a program which uses less
  *    memory and less time.  The article points out that the "symbol" arrays
  *    can be implemented as arrays of pointers to arrays, with dynamic
***************
*** 78,83 ****
--- 81,89 ----
  *
  * Change Log
  * ----------
+ *  6jul89 D.C.Lindsay, CMU: fixed portability bug. Thanks, Gregg Wonderly.
+ *         Just changed "char ch" to "int ch". 
+ *         Also added comment about way to improve code.
  * 10jun89 D.C.Lindsay, CMU: posted version created.
  *         Copyright notice changed to ACM style, and Dept. is now School.
  *         ACM article referenced in docn.
***************
*** 207,213 ****
  void inputscan( pinfo )
  struct info *pinfo;
  {
!      char ch, linebuffer[ MAXLINELEN+1 ];    /* accumulate lines to here */
       int linelen = 0;                        /* # of chars in linebuffer */
  
       pinfo-> maxline = 0;
--- 213,220 ----
  void inputscan( pinfo )
  struct info *pinfo;
  {
!      char linebuffer[ MAXLINELEN+1 ];        /* accumulate lines to here */
!      int ch;
       int linelen = 0;                        /* # of chars in linebuffer */
  
       pinfo-> maxline = 0;

****************< cut here: end of diff -c output >********************
or, in the format of the program itself,

>>>> Difference of file "diff12.c" and file "diff13.c".

>>>> INSERT BEFORE 67
* The program would be better if the "print" variables were wrapped into
*    a struct. In general, grouping related variables in this way improves
*    documentation, and adds the ability to pass the group in argument lists.
>>>> INSERT BEFORE 81
*  6jul89 D.C.Lindsay, CMU: fixed portability bug. Thanks, Gregg Wonderly.
*         Just changed "char ch" to "int ch". 
*         Also added comment about way to improve code.
>>>> 210 CHANGED FROM
     char ch, linebuffer[ MAXLINELEN+1 ];    /* accumulate lines to here */
>>>>     CHANGED TO
     char linebuffer[ MAXLINELEN+1 ];        /* accumulate lines to here */
     int ch;
>>>> End of differences.