LibreOffice
LibreOffice 4.2 SDK C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
alloc.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_RTL_ALLOC_H
21 #define INCLUDED_RTL_ALLOC_H
22 
23 #include <sal/config.h>
24 
25 #include <sal/saldllapi.h>
26 #include <sal/types.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 
41 SAL_DLLPUBLIC void * SAL_CALL rtl_allocateMemory (
42  sal_Size Bytes
44 
45 
60 SAL_DLLPUBLIC void * SAL_CALL rtl_reallocateMemory (
61  void * Ptr,
62  sal_Size Bytes
64 
65 
70 SAL_DLLPUBLIC void SAL_CALL rtl_freeMemory (
71  void * Ptr
73 
74 
83 SAL_DLLPUBLIC void * SAL_CALL rtl_allocateZeroMemory (
84  sal_Size Bytes
86 
87 
93 SAL_DLLPUBLIC void SAL_CALL rtl_freeZeroMemory (
94  void * Ptr,
95  sal_Size Bytes
97 
98 
101 typedef struct rtl_arena_st rtl_arena_type;
102 
103 #define RTL_ARENA_NAME_LENGTH 31
104 
105 
121  const char * pName,
122  sal_Size quantum,
123  sal_Size quantum_cache_max,
124  rtl_arena_type * source_arena,
125  void * (SAL_CALL * source_alloc)(rtl_arena_type *, sal_Size *),
126  void (SAL_CALL * source_free) (rtl_arena_type *, void *, sal_Size),
127  int nFlags
129 
130 
138 SAL_DLLPUBLIC void SAL_CALL rtl_arena_destroy (
139  rtl_arena_type * pArena
141 
142 
152 SAL_DLLPUBLIC void * SAL_CALL rtl_arena_alloc (
153  rtl_arena_type * pArena,
154  sal_Size * pBytes
156 
157 
168 SAL_DLLPUBLIC void SAL_CALL rtl_arena_free (
169  rtl_arena_type * pArena,
170  void * pAddr,
171  sal_Size nBytes
173 
174 
177 typedef struct rtl_cache_st rtl_cache_type;
178 
179 #define RTL_CACHE_NAME_LENGTH 31
180 
181 #define RTL_CACHE_FLAG_BULKDESTROY 1
182 
200  const char * pName,
201  sal_Size nObjSize,
202  sal_Size nObjAlign,
203  int (SAL_CALL * constructor)(void * pObj, void * pUserArg),
204  void (SAL_CALL * destructor) (void * pObj, void * pUserArg),
205  void (SAL_CALL * reclaim) (void * pUserArg),
206  void * pUserArg,
207  rtl_arena_type * pSource,
208  int nFlags
210 
211 
220 SAL_DLLPUBLIC void SAL_CALL rtl_cache_destroy (
221  rtl_cache_type * pCache
223 
224 
231 SAL_DLLPUBLIC void * SAL_CALL rtl_cache_alloc (
232  rtl_cache_type * pCache
234 
235 
245 SAL_DLLPUBLIC void SAL_CALL rtl_cache_free (
246  rtl_cache_type * pCache,
247  void * pObj
249 
250 
251 #ifdef __cplusplus
252 }
253 #endif
254 
255 #endif // INCLUDED_RTL_ALLOC_H
256 
257 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPUBLIC void rtl_arena_free(rtl_arena_type *pArena, void *pAddr, sal_Size nBytes) SAL_THROW_EXTERN_C()
rtl_arena_free()
SAL_DLLPUBLIC void * rtl_arena_alloc(rtl_arena_type *pArena, sal_Size *pBytes) SAL_THROW_EXTERN_C()
rtl_arena_alloc()
SAL_DLLPUBLIC void * rtl_reallocateMemory(void *Ptr, sal_Size Bytes) SAL_THROW_EXTERN_C()
Reallocate memory.
SAL_DLLPUBLIC void * rtl_allocateMemory(sal_Size Bytes) SAL_THROW_EXTERN_C()
Allocate memory.
#define SAL_THROW_EXTERN_C()
Definition: types.h:360
SAL_DLLPUBLIC void rtl_freeZeroMemory(void *Ptr, sal_Size Bytes) SAL_THROW_EXTERN_C()
Zero and free memory.
SAL_DLLPUBLIC void rtl_cache_free(rtl_cache_type *pCache, void *pObj) SAL_THROW_EXTERN_C()
rtl_cache_free()
SAL_DLLPUBLIC void rtl_arena_destroy(rtl_arena_type *pArena) SAL_THROW_EXTERN_C()
rtl_arena_destroy()
SAL_DLLPUBLIC rtl_cache_type * rtl_cache_create(const char *pName, sal_Size nObjSize, sal_Size nObjAlign, int(*constructor)(void *pObj, void *pUserArg), void(*destructor)(void *pObj, void *pUserArg), void(*reclaim)(void *pUserArg), void *pUserArg, rtl_arena_type *pSource, int nFlags) SAL_THROW_EXTERN_C()
rtl_cache_create()
SAL_DLLPUBLIC void * rtl_cache_alloc(rtl_cache_type *pCache) SAL_THROW_EXTERN_C()
rtl_cache_alloc()
SAL_DLLPUBLIC void rtl_cache_destroy(rtl_cache_type *pCache) SAL_THROW_EXTERN_C()
rtl_cache_destroy()
SAL_DLLPUBLIC void * rtl_allocateZeroMemory(sal_Size Bytes) SAL_THROW_EXTERN_C()
Allocate and zero memory.
#define SAL_DLLPUBLIC
Definition: saldllapi.h:30
struct rtl_cache_st rtl_cache_type
Opaque rtl_cache_type.
Definition: alloc.h:177
SAL_DLLPUBLIC void rtl_freeMemory(void *Ptr) SAL_THROW_EXTERN_C()
Free memory.
struct rtl_arena_st rtl_arena_type
Opaque rtl_arena_type.
Definition: alloc.h:101
SAL_DLLPUBLIC rtl_arena_type * rtl_arena_create(const char *pName, sal_Size quantum, sal_Size quantum_cache_max, rtl_arena_type *source_arena, void *(*source_alloc)(rtl_arena_type *, sal_Size *), void(*source_free)(rtl_arena_type *, void *, sal_Size), int nFlags) SAL_THROW_EXTERN_C()
rtl_arena_create()