home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / gnu / utils / bug / 2066 < prev    next >
Encoding:
Text File  |  1992-11-17  |  1.5 KB  |  42 lines

  1. Newsgroups: gnu.utils.bug
  2. Path: sparky!uunet!convex!darwin.sura.net!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!talisman.kaleida.com!conklin
  3. From: conklin@talisman.kaleida.com (J.T. Conklin)
  4. Subject: memory leak in gnu make 3.62
  5. Message-ID: <9211162324.AA06414@talisman.kaleida.com>
  6. Sender: gnulists@ai.mit.edu
  7. Reply-To: conklin@kaleida.com
  8. Organization: GNUs Not Usenet
  9. Distribution: gnu
  10. Date: Mon, 16 Nov 1992 23:24:10 GMT
  11. Approved: bug-gnu-utils@prep.ai.mit.edu
  12. Lines: 28
  13.  
  14. The following patch allocates storage on the stack in the DIRONLY
  15. macro, rather than using the savestring function().  The macro is
  16. a tiny bit uglier, but it doesn't waste memory.
  17.  
  18. Performance should not suffer since good compilers will recognize that
  19. "(p - (s))" is a common subexpression.
  20.  
  21. diff -c make/commands.c:1.1.1.1 make/commands.c:1.3
  22. *** make/commands.c:1.1.1.1    Mon Nov 16 15:12:56 1992
  23. --- make/commands.c    Mon Nov 16 15:12:56 1992
  24. ***************
  25. *** 65,71 ****
  26.   #define    LASTSLASH(s)    rindex ((s), '/')
  27.   #define    FILEONLY(s)    (p != 0 ? p + 1 : (s))
  28.   #define    DIRONLY(s)    (p == 0 ? "./" : p == (s) ? "/" \
  29. !              : savestring ((s), (p - (s)) + 1))
  30.   
  31.     /* $* is the stem from an implicit or static pattern rule.  */
  32.     if (file->stem == 0)
  33. --- 65,71 ----
  34.   #define    LASTSLASH(s)    rindex ((s), '/')
  35.   #define    FILEONLY(s)    (p != 0 ? p + 1 : (s))
  36.   #define    DIRONLY(s)    (p == 0 ? "./" : p == (s) ? "/" \
  37. !              : strncpy(alloca((p - (s)) + 1), s, (p - (s))))
  38.   
  39.     /* $* is the stem from an implicit or static pattern rule.  */
  40.     if (file->stem == 0)
  41.  
  42.