Print this page
3853 __cplusplus change and headers incompatipility with clang


   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*      Copyright (c) 1988 AT&T     */
  23 /*        All Rights Reserved   */
  24 
  25 
  26 #ifndef _MALLOC_H
  27 #define _MALLOC_H
  28 
  29 #pragma ident   "%Z%%M% %I%     %E% SMI"        /* SVr4.0 1.7   */
  30 
  31 #include <sys/types.h>
  32 
  33 #ifdef  __cplusplus
  34 extern "C" {
  35 #endif
  36 
  37 /*
  38  *      Constants defining mallopt operations
  39  */
  40 #define M_MXFAST        1       /* set size of blocks to be fast */
  41 #define M_NLBLKS        2       /* set number of block in a holding block */
  42 #define M_GRAIN         3       /* set number of sizes mapped to one, for */
  43                                 /* small blocks */
  44 #define M_KEEP          4       /* retain contents of block after a free */
  45                                 /* until another allocation */
  46 /*
  47  *      structure filled by
  48  */
  49 struct mallinfo  {
  50         unsigned long arena;    /* total space in arena */
  51         unsigned long ordblks;  /* number of ordinary blocks */
  52         unsigned long smblks;   /* number of small blocks */
  53         unsigned long hblks;    /* number of holding blocks */
  54         unsigned long hblkhd;   /* space in holding block headers */
  55         unsigned long usmblks;  /* space in small blocks in use */
  56         unsigned long fsmblks;  /* space in free small blocks */
  57         unsigned long uordblks; /* space in ordinary blocks in use */
  58         unsigned long fordblks; /* space in free ordinary blocks */
  59         unsigned long keepcost; /* cost of enabling keep option */
  60 };
  61 
  62 #if defined(__STDC__)
  63 






  64 void *malloc(size_t);
  65 void free(void *);
  66 void *realloc(void *, size_t);












  67 int mallopt(int, int);
  68 struct mallinfo mallinfo(void);
  69 void *calloc(size_t, size_t);
  70 
  71 #else
  72 
  73 void *malloc();
  74 void free();
  75 void *realloc();

  76 int mallopt();
  77 struct mallinfo mallinfo();
  78 void *calloc();
  79 
  80 #endif  /* __STDC__ */
  81 
  82 #ifdef  __cplusplus
  83 }
  84 #endif
  85 
  86 #endif  /* _MALLOC_H */


   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*      Copyright (c) 1988 AT&T     */
  23 /*        All Rights Reserved   */
  24 
  25 
  26 #ifndef _MALLOC_H
  27 #define _MALLOC_H
  28 


  29 #include <sys/types.h>
  30 
  31 #ifdef  __cplusplus
  32 extern "C" {
  33 #endif
  34 
  35 /*
  36  *      Constants defining mallopt operations
  37  */
  38 #define M_MXFAST        1       /* set size of blocks to be fast */
  39 #define M_NLBLKS        2       /* set number of block in a holding block */
  40 #define M_GRAIN         3       /* set number of sizes mapped to one, for */
  41                                 /* small blocks */
  42 #define M_KEEP          4       /* retain contents of block after a free */
  43                                 /* until another allocation */
  44 /*
  45  *      structure filled by
  46  */
  47 struct mallinfo  {
  48         unsigned long arena;    /* total space in arena */
  49         unsigned long ordblks;  /* number of ordinary blocks */
  50         unsigned long smblks;   /* number of small blocks */
  51         unsigned long hblks;    /* number of holding blocks */
  52         unsigned long hblkhd;   /* space in holding block headers */
  53         unsigned long usmblks;  /* space in small blocks in use */
  54         unsigned long fsmblks;  /* space in free small blocks */
  55         unsigned long uordblks; /* space in ordinary blocks in use */
  56         unsigned long fordblks; /* space in free ordinary blocks */
  57         unsigned long keepcost; /* cost of enabling keep option */
  58 };
  59 
  60 #if defined(__STDC__)
  61 
  62 #if (!defined(_STRICT_STDC) && !defined(_XOPEN_OR_POSIX)) || \
  63         defined(_XPG3)
  64 #if __cplusplus >= 199711L
  65 namespace std {
  66 #endif
  67 
  68 void *malloc(size_t);
  69 void free(void *);
  70 void *realloc(void *, size_t);
  71 void *calloc(size_t, size_t);
  72 
  73 #if __cplusplus >= 199711L
  74 } /* end of namespace std */
  75 
  76 using std::malloc;
  77 using std::free;
  78 using std::realloc;
  79 using std::calloc;
  80 #endif /* __cplusplus >= 199711L */
  81 #endif /* (!defined(_STRICT_STDC) && !defined(_XOPEN_OR_POSIX)) || ... */
  82 
  83 int mallopt(int, int);
  84 struct mallinfo mallinfo(void);

  85 
  86 #else
  87 
  88 void *malloc();
  89 void free();
  90 void *realloc();
  91 void *calloc();
  92 int mallopt();
  93 struct mallinfo mallinfo();

  94 
  95 #endif  /* __STDC__ */
  96 
  97 #ifdef  __cplusplus
  98 }
  99 #endif
 100 
 101 #endif  /* _MALLOC_H */