ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/savqstr.c
(Generate patch)

Comparing ray/src/common/savqstr.c (file contents):
Revision 2.7 by schorsch, Thu Jul 17 09:21:29 2003 UTC vs.
Revision 2.10 by greg, Fri Jun 1 19:17:17 2012 UTC

# Line 11 | Line 11 | static const char RCSid[] = "$Id$";
11  
12   #include <stdlib.h>
13  
14 + #include "rtio.h"
15   #include "rterror.h"
16  
17  
18   #if 1
19  
20   char *
21 < savqstr(s)                      /* save a private string */
21 < register char  *s;
21 > savqstr(char *s)                        /* save a private string */
22   {
23 <        register char  *cp;
23 >        char  *cp;
24          char  *newp;
25  
26          for (cp = s; *cp++; )                   /* compute strlen()+1 */
# Line 30 | Line 30 | register char  *s;
30                  eputs("out of memory in savqstr");
31                  quit(1);
32          }
33 <        for (cp = newp; *cp++ = *s++; )         /* inline strcpy() */
33 >        for (cp = newp; (*cp++ = *s++); )               /* inline strcpy() */
34                  ;
35          return(newp);                           /* return new location */
36   }
37  
38  
39   void
40 < freeqstr(s)                     /* free a private string */
41 < char  *s;
40 > freeqstr(char *s)                       /* free a private string */
41   {
42          if (s != NULL)
43                  free((void *)s);
# Line 51 | Line 50 | char  *s;
50   *  large blocks to optimize paging in VM environments.
51   */
52  
53 + #include "rtmisc.h"
54 +
55   #ifdef  SMLMEM
56   #ifndef  MINBLOCK
57   #define  MINBLOCK       (1<<10)         /* minimum allocation block size */
# Line 67 | Line 68 | char  *s;
68   #endif
69   #endif
70  
70 extern char  *bmalloc();
71  
72
72   char *
73 < savqstr(s)                      /* save a private string */
75 < register char  *s;
73 > savqstr(char *s)                        /* save a private string */
74   {
75          static char  *curp = NULL;              /* allocated memory pointer */
76          static unsigned  nrem = 0;              /* bytes remaining in block */
77          static unsigned  nextalloc = MINBLOCK;  /* next block size */
78 <        register char  *cp;
79 <        register unsigned  n;
78 >        char  *cp;
79 >        unsigned  n;
80  
81          for (cp = s; *cp++; )                   /* compute strlen()+1 */
82                  ;
# Line 103 | Line 101 | register char  *s;
101  
102  
103   void
104 < freeqstr(s)                     /* free a private string (not recommended) */
107 < char  *s;
104 > freeqstr(char *s)               /* free a private string (not recommended) */
105   {
106          bfree(s, strlen(s)+1);
107   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines