LibreOffice: rtl/alloc.h Source File

LibreOffice LibreOffice 6.4 SDK C/C++ API Reference

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
43 ) SAL_THROW_EXTERN_C();
44
45
60 SAL_DLLPUBLIC void * SAL_CALL rtl_reallocateMemory (
61 void * Ptr,
62 sal_Size Bytes
63 ) SAL_THROW_EXTERN_C();
64
65
70 SAL_DLLPUBLIC void SAL_CALL rtl_freeMemory (
71 void * Ptr
72 ) SAL_THROW_EXTERN_C();
73
82 SAL_DLLPUBLIC void * SAL_CALL rtl_allocateZeroMemory (
83 sal_Size Bytes
84 ) SAL_THROW_EXTERN_C();
85
95 SAL_DLLPUBLIC void SAL_CALL rtl_secureZeroMemory (
96 void * Ptr,
97 sal_Size Bytes
98 ) SAL_THROW_EXTERN_C();
99
100
107 SAL_DLLPUBLIC void SAL_CALL rtl_freeZeroMemory (
108 void * Ptr,
109 sal_Size Bytes
110 ) SAL_THROW_EXTERN_C();
111
127 SAL_DLLPUBLIC void* SAL_CALL rtl_allocateAlignedMemory (
128 sal_Size Alignment,
129 sal_Size Bytes
130 ) SAL_THROW_EXTERN_C();
131
132
140 SAL_DLLPUBLIC void SAL_CALL rtl_freeAlignedMemory (
141 void * Ptr
142 ) SAL_THROW_EXTERN_C();
143
144
147 typedef struct SAL_DLLPUBLIC_RTTI rtl_arena_st rtl_arena_type;
148
149 #define RTL_ARENA_NAME_LENGTH 31
150
151
165 SAL_DLLPUBLIC rtl_arena_type * SAL_CALL rtl_arena_create (
166 const char * pName,
167 sal_Size quantum,
168 sal_Size quantum_cache_max,
169 rtl_arena_type * source_arena,
170 void * (SAL_CALL * source_alloc)(rtl_arena_type *, sal_Size *),
171 void (SAL_CALL * source_free) (rtl_arena_type *, void *, sal_Size),
172 int nFlags
173 ) SAL_THROW_EXTERN_C();
174
175
182 SAL_DLLPUBLIC void SAL_CALL rtl_arena_destroy (
183 rtl_arena_type * pArena
184 ) SAL_THROW_EXTERN_C();
185
186
195 SAL_DLLPUBLIC void * SAL_CALL rtl_arena_alloc (
196 rtl_arena_type * pArena,
197 sal_Size * pBytes
198 ) SAL_THROW_EXTERN_C();
199
200
210 SAL_DLLPUBLIC void SAL_CALL rtl_arena_free (
211 rtl_arena_type * pArena,
212 void * pAddr,
213 sal_Size nBytes
214 ) SAL_THROW_EXTERN_C();
215
216
219 typedef struct rtl_cache_st rtl_cache_type;
220
221 #define RTL_CACHE_NAME_LENGTH 31
222
223 #define RTL_CACHE_FLAG_BULKDESTROY 1 /* obsolete */
224
240 SAL_DLLPUBLIC rtl_cache_type * SAL_CALL rtl_cache_create (
241 const char * pName,
242 sal_Size nObjSize,
243 sal_Size nObjAlign,
244 int (SAL_CALL * constructor)(void * pObj, void * pUserArg),
245 void (SAL_CALL * destructor) (void * pObj, void * pUserArg),
246 void (SAL_CALL * reclaim) (void * pUserArg),
247 void * pUserArg,
248 rtl_arena_type * pSource,
249 int nFlags
250 ) SAL_THROW_EXTERN_C();
251
252
260 SAL_DLLPUBLIC void SAL_CALL rtl_cache_destroy (
261 rtl_cache_type * pCache
262 ) SAL_THROW_EXTERN_C();
263
264
270 SAL_DLLPUBLIC void * SAL_CALL rtl_cache_alloc (
271 rtl_cache_type * pCache
272 ) SAL_THROW_EXTERN_C();
273
274
283 SAL_DLLPUBLIC void SAL_CALL rtl_cache_free (
284 rtl_cache_type * pCache,
285 void * pObj
286 ) SAL_THROW_EXTERN_C();
287
288
289 #ifdef LIBO_INTERNAL_ONLY
290
319 SAL_DLLPUBLIC void SAL_CALL rtl_alloc_preInit (
320 sal_Bool start
321 ) SAL_THROW_EXTERN_C();
324 #endif
325
326 #ifdef __cplusplus
327 }
328 #endif
329
330 #endif // INCLUDED_RTL_ALLOC_H
331
332 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
rtl_cache_create
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()
saldllapi.h
rtl_allocateZeroMemory
SAL_DLLPUBLIC void * rtl_allocateZeroMemory(sal_Size Bytes) SAL_THROW_EXTERN_C()
Allocate and zero memory.
rtl_cache_free
SAL_DLLPUBLIC void rtl_cache_free(rtl_cache_type *pCache, void *pObj) SAL_THROW_EXTERN_C()
rtl_freeAlignedMemory
SAL_DLLPUBLIC void rtl_freeAlignedMemory(void *Ptr) SAL_THROW_EXTERN_C()
Free memory allocated with rtl_allocateAlignedMemory().
rtl_arena_alloc
SAL_DLLPUBLIC void * rtl_arena_alloc(rtl_arena_type *pArena, sal_Size *pBytes) SAL_THROW_EXTERN_C()
rtl_allocateAlignedMemory
SAL_DLLPUBLIC void * rtl_allocateAlignedMemory(sal_Size Alignment, sal_Size Bytes) SAL_THROW_EXTERN_C()
Allocate aligned memory.
rtl_freeMemory
SAL_DLLPUBLIC void rtl_freeMemory(void *Ptr) SAL_THROW_EXTERN_C()
Free memory.
sal_Bool
unsigned char sal_Bool
Definition: types.h:38
config.h
rtl_arena_type
struct SAL_DLLPUBLIC_RTTI rtl_arena_st rtl_arena_type
Opaque rtl_arena_type.
Definition: alloc.h:147
rtl_arena_create
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()
types.h
SAL_DLLPUBLIC
#define SAL_DLLPUBLIC
Definition: saldllapi.h:30
rtl_cache_alloc
SAL_DLLPUBLIC void * rtl_cache_alloc(rtl_cache_type *pCache) SAL_THROW_EXTERN_C()
rtl_cache_type
struct rtl_cache_st rtl_cache_type
Opaque rtl_cache_type.
Definition: alloc.h:219
rtl_reallocateMemory
SAL_DLLPUBLIC void * rtl_reallocateMemory(void *Ptr, sal_Size Bytes) SAL_THROW_EXTERN_C()
Reallocate memory.
rtl_secureZeroMemory
SAL_DLLPUBLIC void rtl_secureZeroMemory(void *Ptr, sal_Size Bytes) SAL_THROW_EXTERN_C()
Zero memory.
rtl_allocateMemory
SAL_DLLPUBLIC void * rtl_allocateMemory(sal_Size Bytes) SAL_THROW_EXTERN_C()
Allocate memory.
rtl_arena_free
SAL_DLLPUBLIC void rtl_arena_free(rtl_arena_type *pArena, void *pAddr, sal_Size nBytes) SAL_THROW_EXTERN_C()
rtl_freeZeroMemory
SAL_DLLPUBLIC void rtl_freeZeroMemory(void *Ptr, sal_Size Bytes) SAL_THROW_EXTERN_C()
Zero and free memory.
SAL_THROW_EXTERN_C
#define SAL_THROW_EXTERN_C()
Nothrow specification for C functions.
Definition: types.h:346
rtl_cache_destroy
SAL_DLLPUBLIC void rtl_cache_destroy(rtl_cache_type *pCache) SAL_THROW_EXTERN_C()
rtl_arena_destroy
SAL_DLLPUBLIC void rtl_arena_destroy(rtl_arena_type *pArena) SAL_THROW_EXTERN_C()