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:
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user