xref: /aoo4110/main/sal/rtl/source/memory.c (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 
25 #include <string.h>
26 #include <rtl/memory.h>
27 
rtl_zeroMemory(void * Ptr,sal_Size Bytes)28 void SAL_CALL rtl_zeroMemory(void *Ptr, sal_Size Bytes)
29 {
30 	memset(Ptr, 0, Bytes);
31 }
32 
rtl_fillMemory(void * Ptr,sal_Size Bytes,sal_uInt8 Fill)33 void SAL_CALL rtl_fillMemory(void *Ptr, sal_Size Bytes, sal_uInt8 Fill)
34 {
35 	memset(Ptr, Fill, Bytes);
36 }
37 
rtl_copyMemory(void * Dst,const void * Src,sal_Size Bytes)38 void SAL_CALL rtl_copyMemory(void *Dst, const void *Src, sal_Size Bytes)
39 {
40 	memcpy(Dst, Src, Bytes);
41 }
42 
rtl_moveMemory(void * Dst,const void * Src,sal_Size Bytes)43 void SAL_CALL rtl_moveMemory(void *Dst, const void *Src, sal_Size Bytes)
44 {
45 	memmove(Dst, Src, Bytes);
46 }
47 
rtl_compareMemory(const void * MemA,const void * MemB,sal_Size Bytes)48 sal_Int32 SAL_CALL rtl_compareMemory(const void *MemA, const void *MemB, sal_Size Bytes)
49 {
50 	return memcmp(MemA, MemB, Bytes);
51 }
52 
rtl_findInMemory(const void * MemA,sal_uInt8 ch,sal_Size Bytes)53 void* SAL_CALL rtl_findInMemory(const void *MemA, sal_uInt8 ch, sal_Size Bytes)
54 {
55 	return memchr(MemA, ch, Bytes);
56 }
57 
58 
59