1
0
mirror of https://github.com/falk-werner/webfuse-provider synced 2026-03-02 04:09:18 +00:00

chore: replaced wf_string_create by asprintf

This commit is contained in:
Falk Werner
2020-06-14 20:28:39 +02:00
parent 01a9488f6e
commit 60141c4d8a
6 changed files with 2 additions and 77 deletions

View File

@@ -9,8 +9,6 @@
#include "webfuse/adapter/impl/session.h"
#include "webfuse/adapter/impl/mountpoint.h"
#include "webfuse/core/string.h"
#include <libwebsockets.h>
#include <sys/stat.h>

View File

@@ -1,32 +0,0 @@
#include "webfuse/core/string.h"
#include <stdio.h>
#include <stdlib.h>
char * wf_create_string(char const * format, ...)
{
char * result = NULL;
va_list measure_args;
va_start(measure_args, format);
char buffer;
int needed = vsnprintf(&buffer, 1, format, measure_args);
va_end(measure_args);
if (0 <= needed)
{
result = malloc(needed + 1);
va_list args;
va_start(args, format);
int count = vsnprintf(result, needed + 1, format, args);
va_end(args);
if ((count < 0) || (needed < count))
{
free(result);
result = NULL;
}
}
return result;
}

View File

@@ -1,21 +0,0 @@
#ifndef WF_CORE_STRING_H
#define WF_CORE_STRING_H
#ifndef __cplusplus
#include <stdarg.h>
#else
#include <cstdarg>
#endif
#ifdef __cplusplus
extern "C"
{
#endif
extern char * wf_create_string(char const * format, ...);
#ifdef __cplusplus
}
#endif
#endif