Correct names and fix declaration issues
This commit is contained in:
+6
-2
@@ -13,6 +13,10 @@
|
||||
* @see https://lowenware.com/
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "string.h"
|
||||
|
||||
@@ -86,13 +90,13 @@ cstuff_vsprintf(char **out, const char *format, va_list args)
|
||||
char tmp, *s;
|
||||
|
||||
va_copy(vc, args);
|
||||
result = vsprintf(&tmp, 1, format, vc);
|
||||
result = vsnprintf(&tmp, 1, format, vc);
|
||||
va_end(vc);
|
||||
|
||||
if (!(s = malloc(result + 1)))
|
||||
return -1;
|
||||
|
||||
result = vsprintf(s, result+1, format, args);
|
||||
result = vsnprintf(s, result+1, format, args);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
+4
-1
@@ -16,7 +16,6 @@
|
||||
#ifndef CSTUFF_STRING_H_938B242C_B750_40E9_8B67_A69F2F37EB87
|
||||
#define CSTUFF_STRING_H_938B242C_B750_40E9_8B67_A69F2F37EB87
|
||||
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include "retcode.h"
|
||||
|
||||
@@ -43,6 +42,10 @@ int
|
||||
cstuff_strset(char **out, const char *in);
|
||||
|
||||
|
||||
int
|
||||
cstuff_strnset(char **out, const char *in, int len);
|
||||
|
||||
|
||||
/** @brief Allocates memory and prints a formatted string into it
|
||||
* @param out a pointer to an address where new string must be stored
|
||||
* @param format a format for string (see manual for stdlib sprintf)
|
||||
|
||||
Reference in New Issue
Block a user