blob: 0f2084742251a14bd410ad8b411cb04f645cd08d [file] [log] [blame]
Igor Opaniuk8b23ae22018-06-03 21:56:36 +03001/*
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
12int avb_memcmp(const void* src1, const void* src2, size_t n) {
13 return memcmp(src1, src2, n);
14}
15
16void* avb_memcpy(void* dest, const void* src, size_t n) {
17 return memcpy(dest, src, n);
18}
19
20void* avb_memset(void* dest, const int c, size_t n) {
21 return memset(dest, c, n);
22}
23
24int avb_strcmp(const char* s1, const char* s2) {
25 return strcmp(s1, s2);
26}
27
28size_t avb_strlen(const char* str) {
29 return strlen(str);
30}
31
32uint32_t avb_div_by_10(uint64_t* dividend) {
33 uint32_t rem = (uint32_t)(*dividend % 10);
34 *dividend /= 10;
35 return rem;
36}
37
38void avb_abort(void) {
39 hang();
40}
41
42void avb_print(const char* message) {
43 printf("%s", message);
44}
45
46void 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
57void* avb_malloc_(size_t size) {
58 return malloc(size);
59}
60
61void avb_free(void* ptr) {
62 free(ptr);
63}