Welcome to mirror list, hosted at ThFree Co, Russian Federation.

pal_string.c « System.Native « Unix « Native « libraries « src - github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f1a7c65ca0e12a51239fca47ff0173a919c64e94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#include "pal_string.h"
#include "pal_utilities.h"

#include <assert.h>
#include <stdarg.h>
#include <stdio.h>

int32_t SystemNative_SNPrintF(char* string, int32_t size, const char* format, ...)
{
    assert(string != NULL || size == 0);
    assert(size >= 0);
    assert(format != NULL);

    if (size < 0)
        return -1;

    va_list arguments;
    va_start(arguments, format);
    int result = vsnprintf(string, Int32ToSizeT(size), format, arguments);
    va_end(arguments);
    return result;
}