Make stdarg an optional header. Some works remain to do to make stdio fully optional
This commit is contained in:
1 parent
3df2408ffb
commit
5f05c1e169
2 files changed
+25
-6
No files matched your search
+12
-5
@@ -26,11 +26,6 @@
|
||||
#ifndef MSTARLIB_STRING_H
|
||||
#define MSTARLIB_STRING_H
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "m-core.h"
|
||||
|
||||
M_BEGIN_PROTECTED_CODE
|
||||
@@ -909,6 +904,8 @@ string_replace_all (string_t v, const string_t str1, const string_t str2)
|
||||
}
|
||||
}
|
||||
|
||||
#if M_USE_STDARG
|
||||
|
||||
/* Format in the string the given printf format */
|
||||
static inline int
|
||||
string_vprintf (string_t v, const char format[], va_list args)
|
||||
@@ -989,6 +986,10 @@ string_cat_printf (string_t v, const char format[], ...)
|
||||
return size;
|
||||
}
|
||||
|
||||
#endif // Have stdarg
|
||||
|
||||
#if M_USE_STDIO
|
||||
|
||||
/* Get a line/pureline/file from the FILE and store it in the string */
|
||||
static inline bool
|
||||
string_fgets(string_t v, FILE *f, string_fgets_t arg)
|
||||
@@ -1099,6 +1100,8 @@ string_fputs(FILE *f, const string_t v)
|
||||
return fputs(string_get_cstr(v), f) >= 0;
|
||||
}
|
||||
|
||||
#endif // Have stdio
|
||||
|
||||
/* Test if the string starts with the given C string */
|
||||
static inline bool
|
||||
string_start_with_str_p(const string_t v, const char str[])
|
||||
@@ -1260,6 +1263,8 @@ string_get_str(string_t v, const string_t v2, bool append)
|
||||
STRINGI_CONTRACT (v);
|
||||
}
|
||||
|
||||
#if M_USE_STDIO
|
||||
|
||||
/* Transform the string 'v2' into a formatted string
|
||||
and output it in the given FILE */
|
||||
static inline void
|
||||
@@ -1343,6 +1348,8 @@ string_in_str(string_t v, FILE *f)
|
||||
return c == '"';
|
||||
}
|
||||
|
||||
#endif // Have stdio
|
||||
|
||||
/* Read the formatted string from the C string
|
||||
and set the converted value in the string 'v'.
|
||||
Return true in case of success
|
||||
|
||||
Reference in new issue
Block a user