1*1bb92983SJerome Forissier // SPDX-License-Identifier: BSD-2-Clause 2b0104773SPascal Brand /* 3fe3ccf24SJerome Forissier * Copyright (c) 2015, Linaro Limited 4fe3ccf24SJerome Forissier * All rights reserved. 5b0104773SPascal Brand * 6b0104773SPascal Brand * Redistribution and use in source and binary forms, with or without 7fe3ccf24SJerome Forissier * modification, are permitted provided that the following conditions are met: 8b0104773SPascal Brand * 9fe3ccf24SJerome Forissier * 1. Redistributions of source code must retain the above copyright notice, 10fe3ccf24SJerome Forissier * this list of conditions and the following disclaimer. 11fe3ccf24SJerome Forissier * 12fe3ccf24SJerome Forissier * 2. Redistributions in binary form must reproduce the above copyright notice, 13fe3ccf24SJerome Forissier * this list of conditions and the following disclaimer in the documentation 14fe3ccf24SJerome Forissier * and/or other materials provided with the distribution. 15fe3ccf24SJerome Forissier * 16fe3ccf24SJerome Forissier * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17fe3ccf24SJerome Forissier * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18b0104773SPascal Brand * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19fe3ccf24SJerome Forissier * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20fe3ccf24SJerome Forissier * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21fe3ccf24SJerome Forissier * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22fe3ccf24SJerome Forissier * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23fe3ccf24SJerome Forissier * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24fe3ccf24SJerome Forissier * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25fe3ccf24SJerome Forissier * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26fe3ccf24SJerome Forissier * POSSIBILITY OF SUCH DAMAGE. 27b0104773SPascal Brand */ 28b0104773SPascal Brand 29b0104773SPascal Brand #include <stdio.h> 30fe3ccf24SJerome Forissier #include <printk.h> 31b0104773SPascal Brand 32fe3ccf24SJerome Forissier int snprintf(char *bf, size_t size, const char *fmt, ...) 33b0104773SPascal Brand { 34b0104773SPascal Brand int retval; 35b0104773SPascal Brand va_list ap; 36b0104773SPascal Brand 37b0104773SPascal Brand va_start(ap, fmt); 38fe3ccf24SJerome Forissier retval = __vsnprintf(bf, size, fmt, ap, false); 39b0104773SPascal Brand va_end(ap); 40d8516202SJens Wiklander 41b0104773SPascal Brand return retval; 42b0104773SPascal Brand } 43b0104773SPascal Brand 44fe3ccf24SJerome Forissier int vsnprintf(char *bf, size_t size, const char *fmt, va_list ap) 45b0104773SPascal Brand { 46fe3ccf24SJerome Forissier return __vsnprintf(bf, size, fmt, ap, false); 47b0104773SPascal Brand } 48