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