Igor Opaniuk | 8b23ae2 | 2018-06-03 21:56:36 +0300 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2016 The Android Open Source Project |
| 3 | * |
| 4 | * SPDX-License-Identifier: MIT |
| 5 | */ |
| 6 | |
| 7 | #include <stdarg.h> |
| 8 | #include <stdlib.h> |
| 9 | |
| 10 | #include "avb_sysdeps.h" |
| 11 | |
| 12 | int avb_memcmp(const void* src1, const void* src2, size_t n) { |
| 13 | return memcmp(src1, src2, n); |
| 14 | } |
| 15 | |
| 16 | void* avb_memcpy(void* dest, const void* src, size_t n) { |
| 17 | return memcpy(dest, src, n); |
| 18 | } |
| 19 | |
| 20 | void* avb_memset(void* dest, const int c, size_t n) { |
| 21 | return memset(dest, c, n); |
| 22 | } |
| 23 | |
| 24 | int avb_strcmp(const char* s1, const char* s2) { |
| 25 | return strcmp(s1, s2); |
| 26 | } |
| 27 | |
| 28 | size_t avb_strlen(const char* str) { |
| 29 | return strlen(str); |
| 30 | } |
| 31 | |
| 32 | uint32_t avb_div_by_10(uint64_t* dividend) { |
| 33 | uint32_t rem = (uint32_t)(*dividend % 10); |
| 34 | *dividend /= 10; |
| 35 | return rem; |
| 36 | } |
| 37 | |
| 38 | void avb_abort(void) { |
| 39 | hang(); |
| 40 | } |
| 41 | |
| 42 | void avb_print(const char* message) { |
| 43 | printf("%s", message); |
| 44 | } |
| 45 | |
| 46 | void avb_printv(const char* message, ...) { |
| 47 | va_list ap; |
| 48 | const char* m; |
| 49 | |
| 50 | va_start(ap, message); |
| 51 | for (m = message; m != NULL; m = va_arg(ap, const char*)) { |
| 52 | printf("%s", m); |
| 53 | } |
| 54 | va_end(ap); |
| 55 | } |
| 56 | |
| 57 | void* avb_malloc_(size_t size) { |
| 58 | return malloc(size); |
| 59 | } |
| 60 | |
| 61 | void avb_free(void* ptr) { |
| 62 | free(ptr); |
| 63 | } |