| Last change
 on this file since 83 was             10, checked in by bird, 23 years ago | 
        
          | 
Initial revision
 | 
        
          | 
              
Property                 cvs2svn:cvs-rev
 set to                 1.1
Property                 svn:eol-style
 set to                 native
Property                 svn:executable
 set to                 * | 
        
          | File size:
            530 bytes | 
      
      
| Line |  | 
|---|
| 1 | /* xmemdup.c -- Duplicate a memory buffer, using xcalloc. | 
|---|
| 2 | This trivial function is in the public domain. | 
|---|
| 3 | Jeff Garzik, September 1999.  */ | 
|---|
| 4 |  | 
|---|
| 5 | #ifdef HAVE_CONFIG_H | 
|---|
| 6 | #include "config.h" | 
|---|
| 7 | #endif | 
|---|
| 8 | #include "ansidecl.h" | 
|---|
| 9 | #include "libiberty.h" | 
|---|
| 10 |  | 
|---|
| 11 | #include <sys/types.h> /* For size_t. */ | 
|---|
| 12 | #ifdef HAVE_STRING_H | 
|---|
| 13 | #include <string.h> | 
|---|
| 14 | #endif | 
|---|
| 15 |  | 
|---|
| 16 | PTR | 
|---|
| 17 | xmemdup (input, copy_size, alloc_size) | 
|---|
| 18 | const PTR input; | 
|---|
| 19 | size_t copy_size; | 
|---|
| 20 | size_t alloc_size; | 
|---|
| 21 | { | 
|---|
| 22 | PTR output = xcalloc (1, alloc_size); | 
|---|
| 23 | memcpy (output, input, copy_size); | 
|---|
| 24 | return output; | 
|---|
| 25 | } | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.