mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-10 19:33:28 +00:00
the vulkan widget now has a generic function for all its getters. also expanded the error system to use strings, making it better for the vulkan side.
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@113 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
25
src/error.c
Normal file
25
src/error.c
Normal file
@@ -0,0 +1,25 @@
|
||||
#include "Mw/Error.h"
|
||||
#include "error_internal.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define MAX_ERROR_LEN 512
|
||||
|
||||
// buffer for holding the error. +1 to ensure there's always a null terminator.
|
||||
char error[MAX_ERROR_LEN + 1] = {0};
|
||||
|
||||
const char* MwGetLastError() {
|
||||
return error;
|
||||
};
|
||||
|
||||
void setLastError(const char* fmt, ...) {
|
||||
va_list va;
|
||||
char out[MAX_ERROR_LEN];
|
||||
memset(out, 0, MAX_ERROR_LEN);
|
||||
|
||||
va_start(va, fmt);
|
||||
vsnprintf(out, MAX_ERROR_LEN, fmt, va);
|
||||
va_end(va);
|
||||
|
||||
memcpy(error, out, MAX_ERROR_LEN);
|
||||
}
|
||||
Reference in New Issue
Block a user