home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sa104os2.zip / SATHR104.ZIP / SATHER / SYSTEM / BUGGYFIX.C < prev    next >
Text File  |  1995-02-14  |  963b  |  41 lines

  1. /* workaround for problem in buggy.c */
  2.  
  3. #include <stdio.h>
  4.  
  5. typedef struct IDENT_struct {
  6.     long z;
  7.  } IDENT;
  8.  
  9. typedef struct TUPIDENTTP_struct {
  10.  IDENT t1;
  11.  long  t2;
  12.  } TUPIDENTTP;
  13. static TUPIDENTTP temp;                             /* added this variable */
  14.  
  15. typedef struct FMAPIDENTTP_struct {
  16.  TUPIDENTTP arr[1];
  17.  } *FMAPIDENTTP;
  18.  
  19. TUPIDENTTP FMAPIDENTTP_aget(FMAPIDENTTP self) {
  20.  return self->arr[0];
  21. }
  22.  
  23. void FMAPIDENTTP_insert(FMAPIDENTTP self) {
  24.  long  n = 5;
  25.  IDENT tk = {2};
  26.  
  27.     fprintf(stderr,"1st n = %i\n", n);                     /* get "5" here */
  28. /* tk = FMAPIDENTTP_aget(self).t1;              replace this line with ... */
  29.    tk = (temp = FMAPIDENTTP_aget(self)).t1;                   /* this line */  
  30.     fprintf(stderr,"2nd n = %i\n", n);                     /* get "5" here */
  31.  return;
  32. }
  33.  
  34. struct FMAPIDENTTP_struct dummy ={{{{9},7}}};
  35.  
  36. int main(void)
  37. {
  38.   FMAPIDENTTP_insert(&dummy);
  39.   return 0;
  40. }
  41.