blob: 25f4656b085230590416b2c1ad92f56c047d8a7b
1 | /* |
2 | * Copyright (C) 2016 The Android Open Source Project |
3 | * |
4 | * Permission is hereby granted, free of charge, to any person |
5 | * obtaining a copy of this software and associated documentation |
6 | * files (the "Software"), to deal in the Software without |
7 | * restriction, including without limitation the rights to use, copy, |
8 | * modify, merge, publish, distribute, sublicense, and/or sell copies |
9 | * of the Software, and to permit persons to whom the Software is |
10 | * furnished to do so, subject to the following conditions: |
11 | * |
12 | * The above copyright notice and this permission notice shall be |
13 | * included in all copies or substantial portions of the Software. |
14 | * |
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
19 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
22 | * SOFTWARE. |
23 | */ |
24 | #define LOG_TAG "control_avb" |
25 | |
26 | #include <log/log.h> |
27 | |
28 | #include <endian.h> |
29 | #include <stdarg.h> |
30 | #include <stdio.h> |
31 | #include <stdlib.h> |
32 | #include <string.h> |
33 | |
34 | #include "avb_sysdeps.h" |
35 | |
36 | int avb_memcmp(const void* src1, const void* src2, size_t n) { |
37 | return memcmp(src1, src2, n); |
38 | } |
39 | |
40 | void* avb_memcpy(void* dest, const void* src, size_t n) { |
41 | return memcpy(dest, src, n); |
42 | } |
43 | |
44 | void* avb_memset(void* dest, const int c, size_t n) { |
45 | return memset(dest, c, n); |
46 | } |
47 | |
48 | int avb_strcmp(const char* s1, const char* s2) { |
49 | return strcmp(s1, s2); |
50 | } |
51 | |
52 | size_t avb_strlen(const char* str) { |
53 | return strlen(str); |
54 | } |
55 | |
56 | void avb_abort(void) { |
57 | ALOGE("********come to avb_abort"); |
58 | abort(); |
59 | } |
60 | |
61 | void avb_print(const char* message) { |
62 | fprintf(stderr, "%s", message); |
63 | ALOGE("********avb_print: %s", message); |
64 | } |
65 | |
66 | void avb_printv(const char* message, ...) { |
67 | va_list ap; |
68 | const char* m; |
69 | |
70 | va_start(ap, message); |
71 | for (m = message; m != NULL; m = va_arg(ap, const char*)) { |
72 | ALOGE("********avb_printv: %s", m); |
73 | fprintf(stderr, "%s", m); |
74 | } |
75 | va_end(ap); |
76 | } |
77 | |
78 | void* avb_malloc_(size_t size) { |
79 | return malloc(size); |
80 | } |
81 | |
82 | void avb_free(void* ptr) { |
83 | free(ptr); |
84 | } |
85 |