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

Comparing ray/src/common/malloc.c (file contents):
Revision 2.12 by greg, Sat Feb 22 02:07:22 2003 UTC vs.
Revision 2.16 by schorsch, Mon Jun 30 14:59:11 2003 UTC

# Line 19 | Line 19 | static const char      RCSid[] = "$Id$";
19   *      Greg Ward       Lawrence Berkeley Laboratory
20   */
21  
22 < /* ====================================================================
23 < * The Radiance Software License, Version 1.0
24 < *
25 < * Copyright (c) 1990 - 2002 The Regents of the University of California,
26 < * through Lawrence Berkeley National Laboratory.   All rights reserved.
27 < *
28 < * Redistribution and use in source and binary forms, with or without
29 < * modification, are permitted provided that the following conditions
30 < * are met:
31 < *
32 < * 1. Redistributions of source code must retain the above copyright
33 < *         notice, this list of conditions and the following disclaimer.
34 < *
35 < * 2. Redistributions in binary form must reproduce the above copyright
36 < *       notice, this list of conditions and the following disclaimer in
37 < *       the documentation and/or other materials provided with the
38 < *       distribution.
39 < *
40 < * 3. The end-user documentation included with the redistribution,
41 < *           if any, must include the following acknowledgment:
42 < *             "This product includes Radiance software
43 < *                 (http://radsite.lbl.gov/)
44 < *                 developed by the Lawrence Berkeley National Laboratory
45 < *               (http://www.lbl.gov/)."
46 < *       Alternately, this acknowledgment may appear in the software itself,
47 < *       if and wherever such third-party acknowledgments normally appear.
48 < *
49 < * 4. The names "Radiance," "Lawrence Berkeley National Laboratory"
50 < *       and "The Regents of the University of California" must
51 < *       not be used to endorse or promote products derived from this
52 < *       software without prior written permission. For written
53 < *       permission, please contact [email protected].
54 < *
55 < * 5. Products derived from this software may not be called "Radiance",
56 < *       nor may "Radiance" appear in their name, without prior written
57 < *       permission of Lawrence Berkeley National Laboratory.
58 < *
59 < * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
60 < * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
61 < * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
62 < * DISCLAIMED.   IN NO EVENT SHALL Lawrence Berkeley National Laboratory OR
63 < * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
64 < * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
65 < * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
66 < * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
67 < * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
68 < * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
69 < * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
70 < * SUCH DAMAGE.
71 < * ====================================================================
72 < *
73 < * This software consists of voluntary contributions made by many
74 < * individuals on behalf of Lawrence Berkeley National Laboratory.   For more
75 < * information on Lawrence Berkeley National Laboratory, please see
76 < * <http://www.lbl.gov/>.
77 < */
22 > #include "copyright.h"
23  
24   #include  <errno.h>
25 + #include  <string.h>
26  
81 #ifndef  BSD
82 #define  bcopy(s,d,n)           (void)memcpy(d,s,n)
83 #define  bzero(d,n)             (void)memset(d,0,n)
84 #endif
27  
28   #ifdef MSTATS
29   #include  <stdio.h>
# Line 237 | Line 179 | unsigned       *np;
179                  cptab.ptr = big->ptr;
180                  cptab.siz = big->siz;
181                  big->siz = 0;                   /* clear and copy */
182 <                bcopy((char *)tab, (char *)(mtab(&cptab)+1),
182 >                memcpy((char *)(mtab(&cptab)+1), (char *)tab,
183                                  tablen*sizeof(struct mblk));
184 <                bzero((char *)(mtab(&cptab)+tablen+1),
184 >                memset((char *)(mtab(&cptab)+tablen+1), '\0',
185                          (mtablen(&cptab)-tablen-1)*sizeof(struct mblk));
186          }                       /* next round */
187   }
# Line 439 | Line 381 | unsigned       n;
381          if ((p = malloc(n)) == NULL)
382                  return(n<=on ? op : NULL);
383          if (on) {
384 <                bcopy(op, p, n>on ? on : n);
384 >                memcpy(p, op, n>on ? on : n);
385                  free(op);
386          }
387          return(p);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines